aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-06 16:55:35 +0200
committerMax Kellermann <max@duempel.org>2008-10-06 16:55:35 +0200
commit14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44 (patch)
treee49cf68dede867b1ead63078e1de07290967a5d5 /src
parent9bc6698a96e318e5c47ae66254c3a8ae3f44bf97 (diff)
downloadmpd-14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44.tar.gz
mpd-14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44.tar.xz
mpd-14cf4e0e78efd95d536ddf73f6b1ebe756d6bd44.zip
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.
Diffstat (limited to '')
-rw-r--r--src/wreadln.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wreadln.c b/src/wreadln.c
index 89bcc123c..926f223b7 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