mirror of
https://github.com/profanity-im/profanity.git
synced 2024-08-18 19:04:14 -04:00
Changed backspace when at end for wide chars
This commit is contained in:
parent
772f5857f0
commit
20a7d52d57
@ -337,14 +337,17 @@ _handle_edit(const wint_t ch, char *input, int *size)
|
|||||||
|
|
||||||
// if at end, delete last char
|
// if at end, delete last char
|
||||||
if (inp_x >= display_size) {
|
if (inp_x >= display_size) {
|
||||||
wmove(inp_win, inp_y, inp_x-1);
|
gchar *start = g_utf8_substring(input, 0, inp_x-1);
|
||||||
wdelch(inp_win);
|
for (*size = 0; *size < strlen(start); (*size)++) {
|
||||||
(*size)--;
|
input[*size] = start[*size];
|
||||||
if (*size > 0) {
|
|
||||||
if (!g_unichar_validate(input[*size])) {
|
|
||||||
(*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
|
// if in middle, delete and shift chars left
|
||||||
} else if (inp_x > 0 && inp_x < display_size) {
|
} else if (inp_x > 0 && inp_x < display_size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user