Fix bug with IME
Adjust how IME works in the terminal co-authored-by: nathan <nathan@zed.dev>
This commit is contained in:
@@ -145,6 +145,7 @@ pub trait PlatformWindow {
|
||||
fn mouse_position(&self) -> Point<Pixels>;
|
||||
fn as_any_mut(&mut self) -> &mut dyn Any;
|
||||
fn set_input_handler(&mut self, input_handler: Box<dyn PlatformInputHandler>);
|
||||
fn clear_input_handler(&mut self);
|
||||
fn prompt(&self, level: PromptLevel, msg: &str, answers: &[&str]) -> oneshot::Receiver<usize>;
|
||||
fn activate(&self);
|
||||
fn set_title(&mut self, title: &str);
|
||||
|
||||
@@ -750,6 +750,10 @@ impl PlatformWindow for MacWindow {
|
||||
self.0.as_ref().lock().input_handler = Some(input_handler);
|
||||
}
|
||||
|
||||
fn clear_input_handler(&mut self) {
|
||||
self.0.as_ref().lock().input_handler = None;
|
||||
}
|
||||
|
||||
fn prompt(&self, level: PromptLevel, msg: &str, answers: &[&str]) -> oneshot::Receiver<usize> {
|
||||
// macOs applies overrides to modal window buttons after they are added.
|
||||
// Two most important for this logic are:
|
||||
|
||||
@@ -89,6 +89,10 @@ impl PlatformWindow for TestWindow {
|
||||
self.input_handler = Some(Arc::new(Mutex::new(input_handler)));
|
||||
}
|
||||
|
||||
fn clear_input_handler(&mut self) {
|
||||
self.input_handler = None;
|
||||
}
|
||||
|
||||
fn prompt(
|
||||
&self,
|
||||
_level: crate::PromptLevel,
|
||||
|
||||
@@ -1231,6 +1231,7 @@ impl<'a> WindowContext<'a> {
|
||||
/// Rotate the current frame and the previous frame, then clear the current frame.
|
||||
/// We repopulate all state in the current frame during each paint.
|
||||
fn start_frame(&mut self) {
|
||||
self.window.platform_window.clear_input_handler();
|
||||
self.text_system().start_frame();
|
||||
|
||||
let window = &mut *self.window;
|
||||
|
||||
Reference in New Issue
Block a user