fix: focus the text box when the window gains focus
This commit is contained in:
parent
8d16f08816
commit
cfebad159f
1 changed files with 10 additions and 0 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -324,6 +324,7 @@ pub enum Message {
|
||||||
FindReplaceValueChanged(String),
|
FindReplaceValueChanged(String),
|
||||||
FindSearchValueChanged(String),
|
FindSearchValueChanged(String),
|
||||||
FindUseRegex(bool),
|
FindUseRegex(bool),
|
||||||
|
Focus,
|
||||||
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
|
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
|
||||||
Key(Modifiers, keyboard::Key),
|
Key(Modifiers, keyboard::Key),
|
||||||
LaunchUrl(String),
|
LaunchUrl(String),
|
||||||
|
|
@ -2342,6 +2343,12 @@ impl Application for App {
|
||||||
self.config.vim_bindings = vim_bindings;
|
self.config.vim_bindings = vim_bindings;
|
||||||
return self.save_config();
|
return self.save_config();
|
||||||
}
|
}
|
||||||
|
Message::Focus => {
|
||||||
|
// focus the text box if context page is not shown
|
||||||
|
if !self.core.window.show_context {
|
||||||
|
return self.update_focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Command::none()
|
Command::none()
|
||||||
|
|
@ -2660,6 +2667,9 @@ impl Application for App {
|
||||||
event::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
|
event::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
|
||||||
Some(Message::Modifiers(modifiers))
|
Some(Message::Modifiers(modifiers))
|
||||||
}
|
}
|
||||||
|
event::Event::Window(id, window::Event::Focused) if id == window::Id::MAIN => {
|
||||||
|
Some(Message::Focus)
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
subscription::channel(
|
subscription::channel(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue