aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-08-19 04:43:28 +0300
committerGitHub <noreply@github.com>2026-08-19 04:43:28 +0300
commita5c69beabfc82d9c3f9563eb821139b2e0f3e14f (patch)
tree9b7049e4629913dcab40d985df399acee262b67b /vendor
parent3667151744e379ac5c8f76d57203b675de8a6ebc (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 'vendor')
-rw-r--r--vendor/libghostty-vt.patches.md37
-rw-r--r--vendor/libghostty-vt/include/ghostty/vt/terminal.h7
-rw-r--r--vendor/libghostty-vt/src/terminal/c/terminal.zig35
-rw-r--r--vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch69
4 files changed, 147 insertions, 1 deletions
diff --git a/vendor/libghostty-vt.patches.md b/vendor/libghostty-vt.patches.md
index 04305960..dff98533 100644
--- a/vendor/libghostty-vt.patches.md
+++ b/vendor/libghostty-vt.patches.md
@@ -38,3 +38,40 @@ cargo nextest run --locked grapheme_cluster_mode_is_default_and_survives_full_re
cargo nextest run --locked grapheme_cluster_mode_renders_flag_emoji_in_single_wide_cell
cargo nextest run --locked grapheme_cluster_mode_renders_zwj_family_in_single_wide_cell
```
+
+## 0002 expose modifyOtherKeys mode through terminal data
+
+status: active
+
+patch: `vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch`
+
+herdr issue: none; fixes the performance regression exposed by
+https://github.com/herdrdev/herdr/pull/2303
+
+upstream discussion: not opened
+
+upstream pr: not opened
+
+vendored base: `c5a21edfcbc2d5b46540ad91b7980aca31f5f1f3`
+
+local files:
+
+- `vendor/libghostty-vt/include/ghostty/vt/terminal.h`
+- `vendor/libghostty-vt/src/terminal/c/terminal.zig`
+
+reason: Herdr must know whether xterm modifyOtherKeys mode 2 is active to
+request printable key releases from the outer terminal. The formatter API can
+recover this fact only by formatting the active screen and scrollback. A typed
+terminal-data query exposes the authoritative scalar without formatting or
+allocation.
+
+remove when: the vendored source exposes an equivalent scalar query for
+modifyOtherKeys mode 2 and Herdr can use it without this patch.
+
+verification:
+
+```sh
+cargo nextest run --locked modify_other_keys_query_tracks_mode_two
+cargo nextest run --locked host_report_all_supplies_printable_releases_for_event_type_only_panes
+python3 -m unittest scripts.test_vendor_libghostty_vt scripts.test_ui_hot_path_architecture
+```
diff --git a/vendor/libghostty-vt/include/ghostty/vt/terminal.h b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
index 26ee0c0b..9bb961d3 100644
--- a/vendor/libghostty-vt/include/ghostty/vt/terminal.h
+++ b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
@@ -1197,6 +1197,13 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Output type: bool *
*/
GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE = 32,
+
+ /**
+ * Whether xterm modifyOtherKeys mode 2 is enabled.
+ *
+ * Output type: bool *
+ */
+ GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS = 33,
GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalData;
diff --git a/vendor/libghostty-vt/src/terminal/c/terminal.zig b/vendor/libghostty-vt/src/terminal/c/terminal.zig
index a896c0fd..0f95fcf1 100644
--- a/vendor/libghostty-vt/src/terminal/c/terminal.zig
+++ b/vendor/libghostty-vt/src/terminal/c/terminal.zig
@@ -757,13 +757,19 @@ pub const TerminalData = enum(c_int) {
kitty_graphics = 30,
selection = 31,
viewport_active = 32,
+ modify_other_keys = 33,
/// Output type expected for querying the data of the given kind.
pub fn OutType(comptime self: TerminalData) type {
return switch (self) {
.invalid => void,
.cols, .rows, .cursor_x, .cursor_y => size.CellCountInt,
- .cursor_pending_wrap, .cursor_visible, .mouse_tracking, .viewport_active => bool,
+ .cursor_pending_wrap,
+ .cursor_visible,
+ .mouse_tracking,
+ .viewport_active,
+ .modify_other_keys,
+ => bool,
.active_screen => TerminalScreen,
.kitty_keyboard_flags => u8,
.scrollbar => TerminalScrollbar,
@@ -899,6 +905,7 @@ fn getTyped(
t.screens.active.selection orelse return .no_value,
),
.viewport_active => out.* = t.screens.active.pages.viewport == .active,
+ .modify_other_keys => out.* = t.flags.modify_other_keys_2,
}
return .success;
@@ -1654,6 +1661,32 @@ test "get kitty_keyboard_flags" {
try testing.expectEqual(3, flags);
}
+test "get modify_other_keys" {
+ var t: Terminal = null;
+ try testing.expectEqual(Result.success, new(
+ &lib.alloc.test_allocator,
+ &t,
+ .{
+ .cols = 80,
+ .rows = 24,
+ .max_scrollback = 0,
+ },
+ ));
+ defer free(t);
+
+ var enabled: bool = undefined;
+ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
+ try testing.expect(!enabled);
+
+ vt_write(t, "\x1b[>4;2m", 7);
+ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
+ try testing.expect(enabled);
+
+ vt_write(t, "\x1b[>4;0m", 7);
+ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
+ try testing.expect(!enabled);
+}
+
test "get mouse_tracking" {
var t: Terminal = null;
try testing.expectEqual(Result.success, new(
diff --git a/vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch b/vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch
new file mode 100644
index 00000000..5d8540db
--- /dev/null
+++ b/vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch
@@ -0,0 +1,69 @@
+diff --git a/vendor/libghostty-vt/include/ghostty/vt/terminal.h b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
+index 26ee0c0b..9bb961d3 100644
+--- a/vendor/libghostty-vt/include/ghostty/vt/terminal.h
++++ b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
+@@ -1199,2 +1199,9 @@ typedef enum GHOSTTY_ENUM_TYPED {
+ GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE = 32,
++
++ /**
++ * Whether xterm modifyOtherKeys mode 2 is enabled.
++ *
++ * Output type: bool *
++ */
++ GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS = 33,
+ GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
+diff --git a/vendor/libghostty-vt/src/terminal/c/terminal.zig b/vendor/libghostty-vt/src/terminal/c/terminal.zig
+index a896c0fd..0f95fcf1 100644
+--- a/vendor/libghostty-vt/src/terminal/c/terminal.zig
++++ b/vendor/libghostty-vt/src/terminal/c/terminal.zig
+@@ -759,3 +759,4 @@ pub const TerminalData = enum(c_int) {
+ viewport_active = 32,
++ modify_other_keys = 33,
+-
++
+ /// Output type expected for querying the data of the given kind.
+@@ -765,3 +766,8 @@ pub const TerminalData = enum(c_int) {
+ .cols, .rows, .cursor_x, .cursor_y => size.CellCountInt,
+- .cursor_pending_wrap, .cursor_visible, .mouse_tracking, .viewport_active => bool,
++ .cursor_pending_wrap,
++ .cursor_visible,
++ .mouse_tracking,
++ .viewport_active,
++ .modify_other_keys,
++ => bool,
+ .active_screen => TerminalScreen,
+@@ -901,2 +907,3 @@ fn getTyped(
+ .viewport_active => out.* = t.screens.active.pages.viewport == .active,
++ .modify_other_keys => out.* = t.flags.modify_other_keys_2,
+ }
+@@ -1655,3 +1662,29 @@ test "get kitty_keyboard_flags" {
+ }
+-
++
++test "get modify_other_keys" {
++ var t: Terminal = null;
++ try testing.expectEqual(Result.success, new(
++ &lib.alloc.test_allocator,
++ &t,
++ .{
++ .cols = 80,
++ .rows = 24,
++ .max_scrollback = 0,
++ },
++ ));
++ defer free(t);
++
++ var enabled: bool = undefined;
++ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
++ try testing.expect(!enabled);
++
++ vt_write(t, "\x1b[>4;2m", 7);
++ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
++ try testing.expect(enabled);
++
++ vt_write(t, "\x1b[>4;0m", 7);
++ try testing.expectEqual(Result.success, get(t, .modify_other_keys, @ptrCast(&enabled)));
++ try testing.expect(!enabled);
++}
++
+ test "get mouse_tracking" {