perf(ui): avoid full pane mode reads for scrollbars (#2554)

This commit is contained in:
akbash
2026-08-09 14:50:11 +03:00
committed by GitHub
parent d277d2f83b
commit e7c38ab37f
4 changed files with 19 additions and 4 deletions
+4
View File
@@ -2596,6 +2596,10 @@ impl PaneRuntime {
self.terminal.input_state()
}
pub fn alternate_screen_active(&self) -> bool {
self.terminal.alternate_screen_active()
}
pub fn cursor_state(&self, area: Rect, show_cursor: bool) -> Option<TerminalCursorState> {
if !show_cursor {
return None;
+10
View File
@@ -388,6 +388,10 @@ impl PaneTerminal {
self.ghostty.input_state()
}
pub fn alternate_screen_active(&self) -> bool {
self.ghostty.alternate_screen_active()
}
pub fn wheel_routing(&self) -> Option<crate::pane::WheelRouting> {
self.ghostty.wheel_routing()
}
@@ -1665,6 +1669,12 @@ impl GhosttyPaneTerminal {
core.kitty_keyboard.replay_ansi()
}
pub fn alternate_screen_active(&self) -> bool {
self.core.lock().is_ok_and(|core| {
core.terminal.active_screen().ok() == Some(crate::ghostty::ActiveScreen::Alternate)
})
}
pub fn input_state(&self) -> Option<InputState> {
let Ok(core) = self.core.lock() else {
return None;
+4
View File
@@ -315,6 +315,10 @@ impl TerminalRuntime {
self.0.input_state()
}
pub fn alternate_screen_active(&self) -> bool {
self.0.alternate_screen_active()
}
pub fn cursor_state(
&self,
area: Rect,
+1 -4
View File
@@ -32,10 +32,7 @@ fn pane_border_title(label: &str, pane_width: u16, _focused: bool) -> Option<Str
}
fn terminal_inner_rect(rt: &TerminalRuntime, pane_inner: Rect, pane_scrollbars: bool) -> Rect {
if !pane_scrollbars
|| pane_inner.width <= 4
|| rt.input_state().is_some_and(|state| state.alternate_screen)
{
if !pane_scrollbars || pane_inner.width <= 4 || rt.alternate_screen_active() {
return pane_inner;
}