Code

wreadln: don't use cursor_move_right() in insert_byte()
[ncmpc.git] / src / wreadln.c
index 89bcc123ce371de17e06b2d9f529755b76ed3ca4..926f223b7fcdc031347cb811370be1a7fdf920cb 100644 (file)
@@ -130,7 +130,10 @@ wreadln_insert_byte(struct wreadln *wr, gint key)
                wr->line + wr->cursor, rest);
        wr->line[wr->cursor] = key;
 
-       cursor_move_right(wr);
+       wr->cursor += length;
+       if (wr->cursor >= (size_t)wr->width &&
+           wr->start < wr->cursor - wr->width + 1)
+               wr->start += length;
 }
 
 static void