From: Patrick Hallen Date: Sat, 28 Mar 2009 18:01:31 +0000 (+0100) Subject: screen_utils: Fixed backspace with widecharacters in screen_jump(). X-Git-Tag: release-0.14~40^2~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c6e69a42f0aa8353b3002ddd77a6e3555dbed424;p=ncmpc.git screen_utils: Fixed backspace with widecharacters in screen_jump(). Deleting widecharacters with backspace would leave bytes in the buffer before. Now every byte of a deleted widecharacter is replaced with '\0'. --- diff --git a/src/screen_utils.c b/src/screen_utils.c index 971b883..8eddfc5 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -244,11 +244,13 @@ screen_jump(struct list_window *lw, key = screen_getch(screen.status_window.w, screen.findbuf); /* if backspace or delete was pressed */ if (key == KEY_BACKSPACE || key == 330) { + int i; /* don't end the loop */ key = 65; if (search_str <= g_utf8_find_prev_char(screen.findbuf, iter)) iter = g_utf8_find_prev_char(screen.findbuf, iter); - *iter = '\0'; + for (i = 0; *(iter + i) != '\0'; i++) + *(iter + i) = '\0'; continue; } else {