From: Max Kellermann Date: Mon, 6 Oct 2008 14:55:35 +0000 (+0200) Subject: wreadln: don't use cursor_move_right() in insert_byte() X-Git-Tag: v0.12_alpha1~49 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44;p=ncmpc.git wreadln: don't use cursor_move_right() in insert_byte() After a byte has been inserted, move the cursor right by just one byte, not one character. The byte may have been the first one in a multibyte character. --- diff --git a/src/wreadln.c b/src/wreadln.c index 89bcc12..926f223 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -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