linux: Fix IBus in vim mode and some compose state fixes (#12299)

Release Notes:

- N/A

Fixes #12198 and some minor fixes:
* IBus was intercepting normal keys like `a`, `k` which caused some
problems in vim mode.
* Wayland: Trying to commit the pre_edit on click wasn't working
properly, should be fixed now.
* X11: The pre_edit was supposed to be cleared when losing keyboard
focus.
* X11: We should commit the pre_edit on click.

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Fernando Tagawa 2024-05-26 21:17:38 -03:00 committed by GitHub
parent 74c972fa37
commit 6276281e8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 185 additions and 30 deletions

View file

@ -170,6 +170,7 @@ pub(crate) struct WaylandWindow(pub WaylandWindowStatePtr);
pub enum ImeInput {
InsertText(String),
SetMarkedText(String),
UnmarkText,
DeleteText,
}
@ -448,6 +449,9 @@ impl WaylandWindowStatePtr {
ImeInput::SetMarkedText(text) => {
input_handler.replace_and_mark_text_in_range(None, &text, None);
}
ImeInput::UnmarkText => {
input_handler.unmark_text();
}
ImeInput::DeleteText => {
if let Some(marked) = input_handler.marked_text_range() {
input_handler.replace_text_in_range(Some(marked), "");