set_surrounding_text needs to send the character length to input methods
Affected version
- Fedora 39
- mutter-45.0-9.fc39, gnome-shell-45.0-1.fc39, gtk4-4.12.3-1.fc39
- Wayland
Bug summary
Now delete_surrounding_text feature can delete the character base instead of the byte base and get_surrounding_text feature also needs to be handled the character base.
Steps to reproduce
- export GTK_IM_MODULE=wayland and run gnome-text-editor
- Type some multi-byte characters likes "あいうえお" in the text buffer
- Enable any IBus engine and calls ibus_engine_get_surrounding_text()
What happened
gnome-shell/js/misc/inputMethod.js:InputMethod::vfunc_set_surrounding()
calls ibus_input_context_set_surrounding_text() with byte offsets cursor
and anchor
.
What did you expect to happen
gnome-shell/js/misc/inputMethod.js:InputMethod::vfunc_set_surrounding()
calls ibus_input_context_set_surrounding_text() with character offsets cursor
and anchor
.
Relevant logs, screenshots, screencasts etc.
delete_surrounding_text is fixed in gtk!5254 (merged)
Seems text-input protocol supports byte offset so GTK and mutter need to convert the value. https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v3.xml?ref_type=heads