spawning a new tab didn't unfocus current pane

This commit centralizes the focus-loss logic to the Window so
that activating a new tab will deactivate the pane in the current
window.

Note that this cannot see overlays in the gui, but overlays shouldn't
care about focus, so it should be ok.

refs: https://github.com/wez/wezterm/discussions/796
This commit is contained in:
Wez Furlong committed 2022-01-18 18:56:26 -07:00
1 parent 067c376eec
commit a590955229
2 files changed
+7 -4

No files matched your search

+7
View File
@@ -186,6 +186,13 @@ impl Window {
/// The saved tab id is not changed.
pub fn set_active_without_saving(&mut self, idx: usize) {
assert!(idx < self.tabs.len());
if self.active != idx {
if let Some(tab) = self.tabs.get(self.active) {
if let Some(pane) = tab.get_active_pane() {
pane.focus_changed(false);
}
}
}
self.active = idx;
self.invalidate();
}
-4
View File
@@ -1606,10 +1606,6 @@ impl TermWindow {
}
fn activate_tab(&mut self, tab_idx: isize) -> anyhow::Result<()> {
if let Some(tab) = self.get_active_pane_or_overlay() {
tab.focus_changed(false);
}
let mux = Mux::get().unwrap();
let mut window = mux
.get_window_mut(self.mux_window_id)