From 463c457528b070f125aebfd41a622a5f6c64e4f0 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 23 Jan 2024 09:30:22 -0700 Subject: [PATCH] thread pane through to other scroll actions as well This should allow mouse bindings that control scrolling to also work with the hovered pane. refs: https://github.com/wez/wezterm/issues/4835 --- wezterm-gui/src/termwindow/mod.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 0a0ae6e55..6f250f0d7 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -2317,11 +2317,7 @@ impl TermWindow { &cache.zones } - fn scroll_to_prompt(&mut self, amount: isize) -> anyhow::Result<()> { - let pane = match self.get_active_pane_or_overlay() { - Some(pane) => pane, - None => return Ok(()), - }; + fn scroll_to_prompt(&mut self, amount: isize, pane: &Arc) -> anyhow::Result<()> { let dims = pane.get_dimensions(); let position = self .get_viewport(pane.pane_id()) @@ -2344,11 +2340,7 @@ impl TermWindow { Ok(()) } - fn scroll_by_page(&mut self, amount: f64) -> anyhow::Result<()> { - let pane = match self.get_active_pane_or_overlay() { - Some(pane) => pane, - None => return Ok(()), - }; + fn scroll_by_page(&mut self, amount: f64, pane: &Arc) -> anyhow::Result<()> { let dims = pane.get_dimensions(); let position = self .get_viewport(pane.pane_id()) @@ -2609,10 +2601,10 @@ impl TermWindow { ReloadConfiguration => config::reload(), MoveTab(n) => self.move_tab(*n)?, MoveTabRelative(n) => self.move_tab_relative(*n)?, - ScrollByPage(n) => self.scroll_by_page(**n)?, + ScrollByPage(n) => self.scroll_by_page(**n, pane)?, ScrollByLine(n) => self.scroll_by_line(*n, pane)?, ScrollByCurrentEventWheelDelta => self.scroll_by_current_event_wheel_delta(pane)?, - ScrollToPrompt(n) => self.scroll_to_prompt(*n)?, + ScrollToPrompt(n) => self.scroll_to_prompt(*n, pane)?, ScrollToTop => self.scroll_to_top(pane), ScrollToBottom => self.scroll_to_bottom(pane), ShowTabNavigator => self.show_tab_navigator(),