wezterm: dont stack search/copy overlays on top of each other

I noticed that repeatedly triggering copy mode kept adding the
`Copy Mode` prefix to the title!
This commit is contained in:
Wez Furlong committed 2020-06-06 17:11:56 -07:00
1 parent 344543260e
commit 5d5083501e
1 file changed
+13 -4
+13 -4
View File
@@ -1586,12 +1586,16 @@ impl TermWindow {
window.invalidate();
}
Search(pattern) => {
let search = SearchOverlay::with_tab(self, tab, pattern.clone());
self.assign_overlay(tab.tab_id(), search);
if let Some(tab) = self.get_active_tab_no_overlay() {
let search = SearchOverlay::with_tab(self, &tab, pattern.clone());
self.assign_overlay(tab.tab_id(), search);
}
}
ActivateCopyMode => {
let copy = CopyOverlay::with_tab(self, tab);
self.assign_overlay(tab.tab_id(), copy);
if let Some(tab) = self.get_active_tab_no_overlay() {
let copy = CopyOverlay::with_tab(self, &tab);
self.assign_overlay(tab.tab_id(), copy);
}
}
};
Ok(())
@@ -3185,6 +3189,11 @@ impl TermWindow {
self.tab_state(tab_id).overlay.clone().or_else(|| Some(tab))
}
fn get_active_tab_no_overlay(&self) -> Option<Rc<dyn Tab>> {
let mux = Mux::get().unwrap();
mux.get_active_tab_for_window(self.mux_window_id)
}
/// Removes any overlay for the specified tab
fn cancel_overlay_for_tab(&self, tab_id: TabId) {
self.tab_state(tab_id).overlay.take();