fix delete key for text editing
This commit is contained in:
parent
1d7c2c6f92
commit
2a07dc1061
1 changed files with 3 additions and 3 deletions
|
@ -43,10 +43,10 @@ int text_input_handle(UINode *node, enum UIEvent ev, size_t d, void *p)
|
|||
break;
|
||||
}
|
||||
case XKB_KEY_Delete: {
|
||||
if (n->text_cursor_index > 0 && n->text_cursor_index + 1 <= n->text.size) {
|
||||
ui_string_delete(&n->text, n->text_cursor_index + 1, 1);
|
||||
if (n->text.size > 0 && n->text_cursor_index < n->text.size) {
|
||||
ui_string_delete(&n->text, n->text_cursor_index, 1);
|
||||
}
|
||||
if (n->text_cursor_index > n->text.size) {
|
||||
if (n->text_cursor_index > 0 && n->text_cursor_index > n->text.size) {
|
||||
n->text_cursor_index = n->text.size - 1;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue