Skip to content

[GTK3] gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text

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 GTK by converting byte based offset to char based offset with the UTF-8 encoded surrounding text.

Fixes #4566 (closed).

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

I did not test this but I tested the GTK4 branch, basically they looks same, and I uploaded video in !5254 (comment 1602410).

Edited by Alynx Zhou

Merge request reports