Skip to content

Commit

Permalink
fix: focus the text box when the window gains focus
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and jackpot51 committed May 9, 2024
1 parent 8d16f08 commit cfebad1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ pub enum Message {
FindReplaceValueChanged(String),
FindSearchValueChanged(String),
FindUseRegex(bool),
Focus,
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
Key(Modifiers, keyboard::Key),
LaunchUrl(String),
Expand Down Expand Up @@ -2342,6 +2343,12 @@ impl Application for App {
self.config.vim_bindings = vim_bindings;
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()
Expand Down Expand Up @@ -2660,6 +2667,9 @@ impl Application for App {
event::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}
event::Event::Window(id, window::Event::Focused) if id == window::Id::MAIN => {
Some(Message::Focus)
}
_ => None,
}),
subscription::channel(
Expand Down

0 comments on commit cfebad1

Please sign in to comment.