Skip to content

wayland/text-input: Convert char based offset to byte based offset in delete_surrounding_text

Alynx Zhou requested to merge AlynxZhou/mutter:wip/fix-delete-surrounding into main

ClutterInputFocus/GtkIMContext uses char based offset for delete_surrounding, however, text_input_v3 uses byte based offset for it. Currently only GTK with mutter can work correctly via text_input_v3 because they both forget to convert between char based offset and byte based offset.

This commit fixes it in mutter by converting char based offset to byte based offset with the UTF-8 encoded surrounding text.

Fixes #2146.

This MR is marked as draft because I did not test it on my system yet.

I already tested them and confirmed they works and uploaded video in gtk!5254 (comment 1602410).

Edited by Alynx Zhou

Merge request reports