NEW326817
[WPE] Wayland text-input-v1 pre-edit cursor and styling offsets are bytes, but are used as characters
https://bugs.webkit.org/show_bug.cgi?id=326817
Summary [WPE] Wayland text-input-v1 pre-edit cursor and styling offsets are bytes, bu...
Simon Pena
Reported 2026-10-08 07:37:57 PDT
The text-input-v1 preedit_cursor event gives the cursor position in bytes from the start of the pre-edit text, and a negative index means no cursor is shown. The preedit_styling event gives index and length in bytes too. WPEInputMethodContextWaylandV1 passes them on unchanged, as the pre-edit cursor offset and as underline ranges, which are both counted in characters. With text that is not ASCII, the cursor position and the underlines are wrong. A negative cursor index becomes a very large unsigned offset; it only ends up at the end of the pre-edit because WebKit clamps it there. The styling events arrive before the preedit_string event they apply to, so the conversion has to happen once the text is known, in get_preedit_string. Found by reading the code and the protocol; not reproduced yet. Bug 326573 is the same problem in text-input-v3 (which was reproduced)
Attachments
Note You need to log in before you can comment on or make changes to this bug.