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/ghostty | |
| 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/ghostty')
| -rw-r--r-- | src/ghostty/bindings.rs | 3 | ||||
| -rw-r--r-- | src/ghostty/mod.rs | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/ghostty/bindings.rs b/src/ghostty/bindings.rs index af743eaa..bf39199e 100644 --- a/src/ghostty/bindings.rs +++ b/src/ghostty/bindings.rs @@ -2574,7 +2574,8 @@ pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_KITTY_GRAPHICS: GhosttyTermi pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_SELECTION: GhosttyTerminalData = 31; #[doc = " Whether the viewport is currently pinned to the active area.\n\n This is true when the viewport is following the active terminal area,\n and false when the user has scrolled into history.\n\n Output type: bool *"] pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE: GhosttyTerminalData = 32; -#[doc = " Whether the viewport is currently pinned to the active area.\n\n This is true when the viewport is following the active terminal area,\n and false when the user has scrolled into history.\n\n Output type: bool *"] +#[doc = " Whether xterm modifyOtherKeys mode 2 is enabled.\n\n Output type: bool *"] +pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS: GhosttyTerminalData = 33; pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MAX_VALUE: GhosttyTerminalData = 2147483647; #[doc = " Terminal data types.\n\n These values specify what type of data to extract from a terminal\n using `ghostty_terminal_get`.\n\n @ingroup terminal"] pub type GhosttyTerminalData = ::std::os::raw::c_uint; diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs index cea7c283..c044d3b0 100644 --- a/src/ghostty/mod.rs +++ b/src/ghostty/mod.rs @@ -1034,6 +1034,10 @@ impl Terminal { self.get_bool(ffi::GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MOUSE_TRACKING) } + pub fn modify_other_keys_enabled(&self) -> Result<bool, Error> { + self.get_bool(ffi::GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS) + } + pub fn active_screen(&self) -> Result<ActiveScreen, Error> { let mut out = ffi::GhosttyTerminalScreen_GHOSTTY_TERMINAL_SCREEN_PRIMARY; unsafe { @@ -3636,6 +3640,17 @@ mod tests { } #[test] + fn modify_other_keys_query_tracks_mode_two() { + let mut terminal = Terminal::new(80, 24, 0).unwrap(); + + assert!(!terminal.modify_other_keys_enabled().unwrap()); + terminal.write(b"\x1b[>4;2m"); + assert!(terminal.modify_other_keys_enabled().unwrap()); + terminal.write(b"\x1b[>4;0m"); + assert!(!terminal.modify_other_keys_enabled().unwrap()); + } + + #[test] fn terminal_read_text_viewport_unwraps_soft_wrapped_selection() { let mut terminal = Terminal::new(5, 3, 0).unwrap(); terminal.write("1ABCD2EFGH3IJKL".as_bytes()); |
