]> git.lizzy.rs Git - linenoise.git/commitdiff
Fix a linenoise bug when moving off the left
authorSteve Bennett <steveb@workware.net.au>
Thu, 18 Oct 2012 22:02:06 +0000 (08:02 +1000)
committerSteve Bennett <steveb@workware.net.au>
Mon, 29 Oct 2012 21:42:30 +0000 (07:42 +1000)
If the buffer is too big to fit in the window and the cursor
would move off the left edge of the windows, the display
is not shown correctly.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
linenoise.c

index ba8ab2a3e3af4b2921e2e90a86bb0d0c225772f4..5c1672a08c9523cf80345ed39c82b60c0eb48700 100644 (file)
@@ -700,7 +700,7 @@ static void refreshLine(const char *prompt, struct current *current)
         n++;
     }
 
-    while (n >= current->cols) {
+    while (n >= current->cols && pos > 0) {
         b = utf8_tounicode(buf, &ch);
         if (ch < ' ') {
             n--;