Skip to content

text_input doesn't handle empty preedit correctly. #2478

@wengxt

Description

@wengxt

if let Some(preedit) = inner.pending_preedit.take() {

If threre is no pending preedit, it means preedit is cleared. The code above should have a else branch that clear the preedit.

See gtk implementation as a reference.
https://github.com/GNOME/gtk/blob/e7501185cd31afae9a08d771e9c6e554aea03a66/gtk/gtkimcontextwayland.c#L191

For example

[1631937.536] zwp_text_input_v3@18.preedit_string("f", 0, 1)
[1631937.567] zwp_text_input_v3@18.done(217)   <- at this point, preedit on client side should be "f|"
[1631942.495] zwp_text_input_v3@18.commit_string("f")
[1631942.542] zwp_text_input_v3@18.done(217)   <- at this point, preedit should be empty, instead of keeping the old "f|".

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - waylandAffects the Wayland backend, or generally free Unix platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions