diff options
Diffstat (limited to 'src/pane')
| -rw-r--r-- | src/pane/terminal.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index fa281553..d697f76d 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -183,6 +183,10 @@ impl PaneTerminal { self.ghostty.input_state() } + pub fn wheel_routing(&self) -> Option<crate::pane::WheelRouting> { + self.ghostty.wheel_routing() + } + pub fn cursor_state(&self) -> Option<TerminalCursorState> { self.ghostty.cursor_state() } @@ -870,6 +874,29 @@ impl GhosttyPaneTerminal { }) } + pub fn wheel_routing(&self) -> Option<crate::pane::WheelRouting> { + let Ok(core) = self.core.lock() else { + return None; + }; + let alternate_screen = + core.terminal.active_screen().ok()? == crate::ghostty::ActiveScreen::Alternate; + let mouse_alternate_scroll = core + .terminal + .mode_get(crate::ghostty::MODE_MOUSE_ALTERNATE_SCROLL) + .ok()?; + let mouse_reporting = core.terminal.mode_get(MODE_MOUSE_ANY_MOTION).ok()? + || core.terminal.mode_get(MODE_MOUSE_BUTTON_MOTION).ok()? + || core.terminal.mode_get(MODE_MOUSE_PRESS_RELEASE).ok()? + || core.terminal.mode_get(MODE_MOUSE_X10).ok()?; + Some(if mouse_reporting { + crate::pane::WheelRouting::MouseReport + } else if alternate_screen && mouse_alternate_scroll { + crate::pane::WheelRouting::AlternateScroll + } else { + crate::pane::WheelRouting::HostScroll + }) + } + pub fn cursor_state(&self) -> Option<TerminalCursorState> { let mut core = self.core.lock().ok()?; let GhosttyPaneCore { |
