diff options
author | kmeaw <kmeaw@flib.ru> | 2009-06-11 13:11:57 +0400 |
---|---|---|
committer | kmeaw <kmeaw@flib.ru> | 2009-06-11 13:11:57 +0400 |
commit | 1b3399fc78549bb54cde385e63518e70e504b90c (patch) | |
tree | ceddca14fcd4c8d1d3c568e42e3cf3b7ce5cc84c /uzbl.c | |
parent | 05fe402bb00c85a6f4c044c0917f2a6bfee87f89 (diff) |
keycmd_bs: fix invalid utf-8 char chopping code
This code failed on strings that end on a multibyte character.
Diffstat (limited to 'uzbl.c')
-rw-r--r-- | uzbl.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -883,9 +883,12 @@ keycmd_nl (WebKitWebView *page, GArray *argv) { static void keycmd_bs (WebKitWebView *page, GArray *argv) { + gchar *prev; (void)page; (void)argv; - g_string_truncate(uzbl.state.keycmd, uzbl.state.keycmd->len - 1); + prev = g_utf8_find_prev_char(uzbl.state.keycmd->str, uzbl.state.keycmd->str + uzbl.state.keycmd->len); + if (prev) + g_string_truncate(uzbl.state.keycmd, prev - uzbl.state.keycmd->str); update_title(); } |