WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
327412
[GTK][WPE] Input method delete-surrounding is documented in characters but counts UTF-16 code units
https://bugs.webkit.org/show_bug.cgi?id=327412
Summary
[GTK][WPE] Input method delete-surrounding is documented in characters but co...
Simon Pena
Reported
2026-10-13 09:21:10 PDT
The delete-surrounding signal of WebKitInputMethodContext and WPEInputMethodContext documents offset and n_chars as characters. WebPage::deleteSurrounding() counts UTF-16 code units, and has done since the signal was added (
bug 205716
). The two only differ outside the Basic Multilingual Plane, for example with emoji. With the caret after "a😀": - delete-surrounding(-1, 1) deletes nothing: it covers half of the emoji's surrogate pair. - delete-surrounding(-2, 2) deletes the emoji. A delete that would start before the text depends on the code units too: after "a😀", (-4, 4) deletes nothing; after "aa😀", it deletes everything. Two more behaviours are not documented, and input methods rely on them: - The offset is counted from the start of the selection, and the delete can reach into the selection. - A count of 0 moves the caret by offset. Input method code in use counts in different units. wpe-android forwards Android's counts, which are UTF-16 code units, and we know of at least one other embedder that counts UTF-16 code units. The Wayland text-input-v1 backend converts to code points. The text-input-v3 backend passes bytes (
bug 326818
). Proposal: document UTF-16 code units, the selection start and the zero-count caret move. That matches what WebKit does today and changes no behaviour. Then make the Wayland backends convert to UTF-16 code units. Changing the behaviour to code points would break the embedders that count UTF-16 code units.
Attachments
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2026-10-18 22:38:00 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/77486
EWS
Comment 2
2026-10-19 05:35:17 PDT
Committed
324121@main
(c8f1f0f55c5f): <
https://commits.webkit.org/324121@main
> Reviewed commits have been landed. Closing PR #77486 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug