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

@ -579,6 +579,28 @@ impl X11WindowStatePtr {
}
}
pub fn handle_ime_unmark(&self) {
let mut state = self.state.borrow_mut();
if let Some(mut input_handler) = state.input_handler.take() {
drop(state);
input_handler.unmark_text();
let mut state = self.state.borrow_mut();
state.input_handler = Some(input_handler);
}
}
pub fn handle_ime_delete(&self) {
let mut state = self.state.borrow_mut();
if let Some(mut input_handler) = state.input_handler.take() {
drop(state);
if let Some(marked) = input_handler.marked_text_range() {
input_handler.replace_text_in_range(Some(marked), "");
}
let mut state = self.state.borrow_mut();
state.input_handler = Some(input_handler);
}
}
pub fn get_ime_area(&self) -> Option<Bounds<Pixels>> {
let mut state = self.state.borrow_mut();
let mut bounds: Option<Bounds<Pixels>> = None;