diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-19 04:43:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-19 04:43:28 +0300 |
| commit | a5c69beabfc82d9c3f9563eb821139b2e0f3e14f (patch) | |
| tree | 9b7049e4629913dcab40d985df399acee262b67b /src/app | |
| parent | 3667151744e379ac5c8f76d57203b675de8a6ebc (diff) | |
fix(perf): eliminate redundant terminal wake work (#2962)
* fix(perf): eliminate redundant terminal wake work
* fix(perf): harden release benchmark gate
* test(perf): strengthen performance guardrails
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/actions.rs | 5 | ||||
| -rw-r--r-- | src/app/api_helpers.rs | 5 | ||||
| -rw-r--r-- | src/app/input/mouse.rs | 4 | ||||
| -rw-r--r-- | src/app/input/terminal.rs | 13 | ||||
| -rw-r--r-- | src/app/mod.rs | 2 | ||||
| -rw-r--r-- | src/app/state.rs | 23 |
6 files changed, 29 insertions, 23 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs index d6e264f5..a45687b4 100644 --- a/src/app/actions.rs +++ b/src/app/actions.rs @@ -2175,10 +2175,7 @@ impl AppState { else { return false; }; - if rt - .input_state() - .is_some_and(crate::pane::InputState::mouse_reporting_enabled) - { + if rt.mouse_reporting_enabled() { return false; } diff --git a/src/app/api_helpers.rs b/src/app/api_helpers.rs index 95224b9f..a224938d 100644 --- a/src/app/api_helpers.rs +++ b/src/app/api_helpers.rs @@ -23,10 +23,7 @@ fn normalize_api_key_alias(key: &str) -> &str { } pub(super) fn encode_api_text(runtime: &crate::terminal::TerminalRuntime, text: &str) -> Vec<u8> { - let bracketed = runtime - .input_state() - .map(|state| state.bracketed_paste) - .unwrap_or(false); + let bracketed = runtime.bracketed_paste_enabled(); if bracketed { format!("\x1b[200~{text}\x1b[201~").into_bytes() } else { diff --git a/src/app/input/mouse.rs b/src/app/input/mouse.rs index 3066c2a4..3c6c86f4 100644 --- a/src/app/input/mouse.rs +++ b/src/app/input/mouse.rs @@ -1761,9 +1761,7 @@ impl AppState { let Some(host) = self.host_mouse_pixels else { return Some(cell); }; - let wants_pixels = runtime.input_state().is_some_and(|state| { - state.mouse_protocol_encoding == crate::input::MouseProtocolEncoding::SgrPixels - }); + let wants_pixels = runtime.sgr_pixel_mouse_enabled(); if !wants_pixels { return Some(cell); } diff --git a/src/app/input/terminal.rs b/src/app/input/terminal.rs index e5b40a74..6b3d3537 100644 --- a/src/app/input/terminal.rs +++ b/src/app/input/terminal.rs @@ -154,8 +154,8 @@ impl App { if matches!(key_event.code, KeyCode::PageUp | KeyCode::PageDown) && key_event.modifiers.is_empty() { - if let Some(input_state) = rt.input_state() { - if input_state.plain_page_keys_use_host_scrollback() { + if let Some(host_scroll) = rt.plain_page_keys_use_host_scrollback() { + if host_scroll { if key_event.kind == crossterm::event::KeyEventKind::Release { return None; } @@ -282,14 +282,7 @@ impl App { None }; - runtime.is_some_and(|runtime| { - let protocol = runtime.keyboard_protocol(); - protocol.reports_all_keys() - || (protocol.reports_event_types() - && runtime - .input_state() - .is_some_and(|state| state.modify_other_keys)) - }) + runtime.is_some_and(crate::terminal::TerminalRuntime::keyboard_report_all_requested) } fn terminal_input_runtime( diff --git a/src/app/mod.rs b/src/app/mod.rs index 75568990..85ad4fa3 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1065,6 +1065,8 @@ impl App { } let now = Instant::now(); + self.render_dirty + .set_immediate_pty_sources(self.state.app_surface_pane_ids()); self.sync_host_mouse_capture(&mut host_mouse_capture_active)?; self.sync_host_keyboard_report_all(&mut host_keyboard_report_all_active)?; diff --git a/src/app/state.rs b/src/app/state.rs index b8205451..d9dcfc9d 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -1614,6 +1614,26 @@ impl AppState { section == SettingsSection::Integrations && self.integration_updates_available() } + pub(crate) fn app_surface_pane_ids(&self) -> std::collections::HashSet<PaneId> { + let mut pane_ids = std::collections::HashSet::new(); + if let Some(popup) = &self.popup_pane { + pane_ids.insert(popup.pane_id); + } + let Some(tab) = self + .active + .and_then(|ws_idx| self.workspaces.get(ws_idx)) + .and_then(crate::workspace::Workspace::active_tab) + else { + return pane_ids; + }; + if tab.zoomed { + pane_ids.insert(tab.layout.focused()); + } else { + pane_ids.extend(tab.panes.keys().copied()); + } + pane_ids + } + pub(crate) fn focused_pane_requests_mouse_capture_from( &self, terminal_runtimes: &crate::terminal::TerminalRuntimeRegistry, @@ -1622,8 +1642,7 @@ impl AppState { && self .active .and_then(|idx| self.focused_runtime_in_workspace(terminal_runtimes, idx)) - .and_then(crate::terminal::TerminalRuntime::input_state) - .is_some_and(crate::pane::InputState::mouse_reporting_enabled) + .is_some_and(crate::terminal::TerminalRuntime::mouse_reporting_enabled) } pub(crate) fn should_capture_host_mouse_from( |
