focus on settings when open

This commit is contained in:
Dongdong Zhou 2022-05-24 13:46:14 +01:00
parent 9f622bafbe
commit 4d0ef4adc0
1 changed files with 12 additions and 0 deletions

View File

@ -2171,6 +2171,11 @@ pub fn open_settings(&mut self, ctx: &mut EventCtx) {
Arc::make_mut(self.editor_tabs.get_mut(&active).unwrap());
for (i, child) in editor_tab.children.iter().enumerate() {
if let EditorTabChild::Settings(_, _) = child {
ctx.submit_command(Command::new(
LAPCE_UI_COMMAND,
LapceUICommand::Focus,
Target::Widget(active),
));
editor_tab.active = i;
return;
}
@ -2193,6 +2198,13 @@ pub fn open_settings(&mut self, ctx: &mut EventCtx) {
self.editor_tab_new_settings(ctx, editor_tab_id);
}
}
if let Some(active) = *self.active_tab {
ctx.submit_command(Command::new(
LAPCE_UI_COMMAND,
LapceUICommand::Focus,
Target::Widget(active),
));
}
}
pub fn jump_to_location(