From 14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Oct 2008 16:55:35 +0200 Subject: [PATCH] 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. --- src/wreadln.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.30.2