1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 12:23:46 +03:00

wezterm: fixup per-pane overlay rendering and handling

refs: https://github.com/wez/wezterm/issues/157
This commit is contained in:
Wez Furlong 2020-09-27 00:19:05 -07:00
parent 146b4465ba
commit 0e8ac1851d
3 changed files with 25 additions and 3 deletions

View File

@ -163,7 +163,7 @@ impl CopyRenderable {
fn close(&self) {
self.set_viewport(None);
TermWindow::schedule_cancel_overlay(self.window.clone(), self.delegate.pane_id());
TermWindow::schedule_cancel_overlay_for_pane(self.window.clone(), self.delegate.pane_id());
}
fn page_up(&mut self) {

View File

@ -267,7 +267,7 @@ impl SearchRenderable {
}
fn close(&self) {
TermWindow::schedule_cancel_overlay(self.window.clone(), self.delegate.pane_id());
TermWindow::schedule_cancel_overlay_for_pane(self.window.clone(), self.delegate.pane_id());
}
fn set_viewport(&self, row: Option<StableRowIndex>) {

View File

@ -3868,7 +3868,13 @@ impl TermWindow {
pane,
}]
} else {
tab.iter_panes()
let mut panes = tab.iter_panes();
for p in &mut panes {
if let Some(overlay) = self.pane_state(p.pane.pane_id()).overlay.as_ref() {
p.pane = Rc::clone(overlay);
}
}
panes
}
}
@ -3889,6 +3895,22 @@ impl TermWindow {
});
}
fn cancel_overlay_for_pane(&self, pane_id: PaneId) {
self.pane_state(pane_id).overlay.take();
if let Some(window) = self.window.as_ref() {
window.invalidate();
}
}
pub fn schedule_cancel_overlay_for_pane(window: Window, pane_id: PaneId) {
window.apply(move |myself, _| {
if let Some(myself) = myself.downcast_mut::<Self>() {
myself.cancel_overlay_for_pane(pane_id);
}
Ok(())
});
}
pub fn assign_overlay_for_pane(&mut self, pane_id: PaneId, overlay: Rc<dyn Pane>) {
self.pane_state(pane_id).overlay.replace(overlay);
self.update_title();