clients: keyboard: fix delete before cursor

When editing a text field in chromium deleting the surrounding text with
backspace fails with `The selection range for surrounding text is invalid`

It seems like `(start - keyboard->surrounding_text) - keyboard->surrounding_cursor` evaluates to -1.

As far as i can tell `start - keyboard->surrounding_text` evaluates to
the index in the surrounding_text char arrays that should be deleted.

Signed-off-by: Aske Bækdal Møller <aske@geanix.com>
(cherry picked from commit 33ec3898d0)
This commit is contained in:
Aske Bækdal Møller 2023-04-24 12:46:25 +02:00 committed by Marius Vlad
parent 6f26c009c1
commit 7e1115479b
1 changed files with 1 additions and 1 deletions

View File

@ -506,7 +506,7 @@ delete_before_cursor(struct virtual_keyboard *keyboard)
end = keyboard->surrounding_text + keyboard->surrounding_cursor;
zwp_input_method_context_v1_delete_surrounding_text(keyboard->context,
(start - keyboard->surrounding_text) - keyboard->surrounding_cursor,
start - keyboard->surrounding_text,
end - start);
zwp_input_method_context_v1_commit_string(keyboard->context,
keyboard->serial,