diff options
author | James Booth <boothj5@gmail.com> | 2013-01-03 23:54:12 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-03 23:54:12 +0000 |
commit | 20a7d52d5767bfbe624f536568f0083c44d7b73a (patch) | |
tree | a4c1bb38d9aac8c9a50b21a128f5f7465d6cc5ab /src | |
parent | 772f5857f0da7e774fc8f45f51d9c8ea93a3cda0 (diff) | |
download | profani-tty-20a7d52d5767bfbe624f536568f0083c44d7b73a.tar.gz |
Changed backspace when at end for wide chars
Diffstat (limited to 'src')
-rw-r--r-- | src/input_win.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/input_win.c b/src/input_win.c index a25b33e3..885658a3 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -337,14 +337,17 @@ _handle_edit(const wint_t ch, char *input, int *size) // if at end, delete last char if (inp_x >= display_size) { - wmove(inp_win, inp_y, inp_x-1); - wdelch(inp_win); - (*size)--; - if (*size > 0) { - if (!g_unichar_validate(input[*size])) { - (*size)--; - } + gchar *start = g_utf8_substring(input, 0, inp_x-1); + for (*size = 0; *size < strlen(start); (*size)++) { + input[*size] = start[*size]; } + input[*size] = '\0'; + + g_free(start); + + inp_clear(); + wprintw(inp_win, input); + wmove(inp_win, 0, inp_x -1); // if in middle, delete and shift chars left } else if (inp_x > 0 && inp_x < display_size) { |