diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/patches | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/patches')
3 files changed, 62 insertions, 56 deletions
diff --git a/vendor/patches/libghostty-vt/0001-default-grapheme-cluster-mode.patch b/vendor/patches/libghostty-vt/0001-default-grapheme-cluster-mode.patch deleted file mode 100644 index 26a950d5..00000000 --- a/vendor/patches/libghostty-vt/0001-default-grapheme-cluster-mode.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: herdr maintainers <maintainers@herdr.dev> -Date: Wed, 15 Jul 2026 00:00:00 +0000 -Subject: [PATCH] default lib-vt panes to grapheme clustering - -Herdr renders libghostty-vt cells directly and requires DEC mode 2027 to -store multi-codepoint grapheme clusters in one terminal cell. Set it in the -terminal's default modes so RIS restores clustering instead of disabling it. - -Herdr issue: https://github.com/herdrdev/herdr/issues/243 -Vendored base: c5a21edfcbc2d5b46540ad91b7980aca31f5f1f3 ---- -diff --git a/vendor/libghostty-vt/src/terminal/c/terminal.zig b/vendor/libghostty-vt/src/terminal/c/terminal.zig -index 1c3b9f0c..a896c0fd 100644 ---- a/vendor/libghostty-vt/src/terminal/c/terminal.zig -+++ b/vendor/libghostty-vt/src/terminal/c/terminal.zig -@@ -344,4 +344,5 @@ fn new_( - .rows = opts.rows, - .max_scrollback = opts.max_scrollback, -+ .default_modes = .{ .grapheme_cluster = true }, - }); - errdefer t.deinit(alloc); 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 index 5d8540db..49a2679c 100644 --- a/vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch +++ b/vendor/patches/libghostty-vt/0002-expose-modify-other-keys-mode.patch @@ -1,56 +1,53 @@ -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, +@@ -1951,6 +1951,14 @@ + * Output type: size_t * + */ + GHOSTTY_TERMINAL_DATA_CLIPBOARD_WRITE_MAX_BYTES = 40, + + /** + * Whether xterm modifyOtherKeys mode 2 is enabled. + * + * Output type: bool * + */ -+ GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS = 33, ++ GHOSTTY_TERMINAL_DATA_MODIFY_OTHER_KEYS = 41, ++ 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 + } GhosttyTerminalData; + --- 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, -- -+ +@@ -1556,6 +1556,7 @@ + vt_ground = 38, + cursor_at_prompt = 39, + clipboard_write_max_bytes = 40, ++ modify_other_keys = 41, + /// 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, + pub fn OutType(comptime self: TerminalData) type { +@@ -1569,6 +1570,7 @@ + .vt_processing_error, + .vt_ground, + .cursor_at_prompt, + .modify_other_keys, -+ => bool, + => bool, .active_screen => TerminalScreen, -@@ -901,2 +907,3 @@ fn getTyped( + .kitty_keyboard_flags => u8, +@@ -1719,6 +1721,7 @@ + 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, - } -@@ -1655,3 +1662,29 @@ test "get kitty_keyboard_flags" { + .vt_processing_error => out.* = wrapper.stream.handler.semantic_failure, + .vt_ground => out.* = wrapper.stream.ground(), + .scrollback_max_bytes => { +@@ -3139,6 +3142,24 @@ + 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, -+ }, -+ )); ++ try testing.expectEqual(Result.success, new(&lib.alloc.test_allocator, &t, 80, 24)); + defer free(t); + + var enabled: bool = undefined; @@ -67,3 +64,5 @@ index a896c0fd..0f95fcf1 100644 +} + test "get mouse_tracking" { + var t: Terminal = null; + try testing.expectEqual(Result.success, new( diff --git a/vendor/patches/libghostty-vt/0004-fix-hosted-wuffs-builds.patch b/vendor/patches/libghostty-vt/0004-fix-hosted-wuffs-builds.patch new file mode 100644 index 00000000..7f978da3 --- /dev/null +++ b/vendor/patches/libghostty-vt/0004-fix-hosted-wuffs-builds.patch @@ -0,0 +1,29 @@ +--- a/vendor/libghostty-vt/pkg/wuffs/build.zig ++++ b/vendor/libghostty-vt/pkg/wuffs/build.zig +@@ -59,6 +59,7 @@ + .target = target, + .optimize = optimize, + .link_libc = windows, ++ .libc_file = if (b.libc_file) |path| .{ .cwd_relative = path } else null, + }); + + // Wuffs only needs stdlib.h and string.h from libc, and only for +--- a/vendor/libghostty-vt/pkg/wuffs/src/main.zig ++++ b/vendor/libghostty-vt/pkg/wuffs/src/main.zig +@@ -19,12 +19,11 @@ + // Wuffs' generated `wuffs_foo__bar__alloc()` convenience functions are the + // only code that references libc's calloc/free. We never call them + // and linker garbage collection strips them, but that isn't guaranteed. +-// When libc isn't linked there would be nothing to provide calloc/free if +-// they survive, so export stubs to satisfy the link. Weak so that any real +-// definition wins. Hidden keeps them out of the export table where the +-// format honors it (e.g. wasm). ++// Freestanding consumers may have no allocator to resolve these symbols. ++// Never export stubs for hosted targets: hidden weak symbols in a static ++// archive can override the embedding executable's dynamically linked libc. + comptime { +- if (!builtin.link_libc) { ++ if (!builtin.link_libc and builtin.os.tag == .freestanding) { + @export(&callocStub, .{ + .name = "calloc", + .linkage = .weak, |
