Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 63 additions & 62 deletions docs/ghostty-fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,26 @@ When we change the fork, update this document and the parent submodule SHA.

## Current fork changes

Fork rebased onto upstream `v1.3.0` plus newer `main` commits as of March 12, 2026.
Fork rebased onto upstream `main` at `3509ccf78` (`v1.3.1-457-g3509ccf78`) on March 30, 2026.
Current cmux fork head: `0b231db94` (`v1.3.1-472-g0b231db94`).

### 1) OSC 99 (kitty) notification parser
### 1) macOS display link restart on display changes

- Commit: `a2252e7a9` (Add OSC 99 notification parser)
- Files:
- `src/terminal/osc.zig`
- `src/terminal/osc/parsers.zig`
- `src/terminal/osc/parsers/kitty_notification.zig`
- Summary:
- Adds a parser for kitty OSC 99 notifications and wires it into the OSC dispatcher.

### 2) macOS display link restart on display changes

- Commit: `c07e6c5a5` (macos: restart display link after display ID change)
- Commit: `05cf31b38` (macos: restart display link after display ID change)
- Files:
- `src/renderer/generic.zig`
- Summary:
- Restarts the CVDisplayLink when `setMacOSDisplayID` updates the current CGDisplay.
- Prevents a rare state where vsync is "running" but no callbacks arrive, which can look like a frozen surface until focus/occlusion changes.

### 3) Keyboard copy mode selection C API

- Commit: `a50579bd5` (Add C API for keyboard copy mode selection)
- Files:
- `src/Surface.zig`
- `src/apprt/embedded.zig`
- Summary:
- Restores `ghostty_surface_select_cursor_cell` and `ghostty_surface_clear_selection`.
- Keeps cmux keyboard copy mode working against the refreshed Ghostty base.

### 4) macOS resize stale-frame mitigation
### 2) macOS resize stale-frame mitigation

Sections 3 and 4 are grouped by feature, not by commit order. The section 4 resize commits were
applied earlier than the section 3 copy-mode commit, but they are kept together here because they
touch the same stale-frame mitigation path and tend to conflict in the same files during rebases.
The resize commits are grouped by feature because they touch the same stale-frame replay path and
tend to conflict together during rebases.

- Commits:
- `769bbf7a9` (macos: reduce transient blank/scaled frames during resize)
- `9efcdfdf8` (macos: keep top-left gravity for stale-frame replay)
- `a3588ac53` (macos: reduce transient blank/scaled frames during resize)
- `9ba54a68c` (macos: keep top-left gravity for stale-frame replay)
- Files:
- `pkg/macos/animation.zig`
- `src/Surface.zig`
Expand All @@ -63,44 +43,62 @@ touch the same stale-frame mitigation path and tend to conflict in the same file
- Replays the last rendered frame during resize and keeps its geometry anchored correctly.
- Reduces transient blank or scaled frames while a macOS window is being resized.

### 5) zsh prompt redraw markers use OSC 133 P

- Commit: `8ade43ce5` (zsh: use OSC 133 P for prompt redraws)
- Files:
- `src/shell-integration/zsh/ghostty-integration`
- Summary:
- Emits one `OSC 133;A` fresh-prompt mark for real prompt transitions.
- Uses `OSC 133;P` markers for prompt redraws so async zsh themes do not look like extra prompt lines.

### 6) zsh Pure-style multiline prompt redraws
### 3) OSC 99 (kitty) notification parser

- Commits:
- `0cf559581` (zsh: fix Pure-style multiline prompt redraws)
- `312c7b23a` (zsh: avoid extra Pure continuation markers)
- `404a3f175` (Fix Pure prompt redraw markers)
- `2033ffebc` (Add OSC 99 notification parser)
- `a75615992` (Fix OSC 99 parser for upstream API changes)
- Files:
- `src/shell-integration/zsh/ghostty-integration`
- `src/terminal/osc.zig`
- `src/terminal/osc/parsers.zig`
- `src/terminal/osc/parsers/kitty_notification.zig`
- Summary:
- Handles multiline prompts that use `\n%{\r%}` to return to column 0 before the visible prompt line.
- Keeps redraw-safe prompt-start markers for async themes.
- Avoids inserting an explicit continuation marker after Pure's hidden carriage return, because Ghostty already tracks the newline as prompt continuation and the extra marker duplicates the preprompt row.
- Restores that prompt-marker behavior on top of the current Ghostty `main` base after the older redraw fix drifted out during later submodule updates.

The fork branch HEAD is now the section 6 zsh redraw follow-up commit.
- Adds a parser for kitty OSC 99 notifications and wires it into the OSC dispatcher.
- Adapts the parser to upstream's newer capture API so the cmux OSC 99 hook survives the March 30 upstream sync.

### 7) cmux theme picker helper hooks
### 4) cmux theme picker helper hooks

- Commit: `0c52c987b` (Add cmux theme picker helper hooks)
- Commits:
- `1da7281fd` (Add cmux theme picker helper hooks)
- `ea482b73e` (Fix cmux theme picker preview writes)
- `c7ab66056` (Improve cmux theme picker footer contrast)
- `c49f69f7b` (Respect system theme in cmux picker)
- `599b0ff43` (Skip theme detection in cmux picker)
- `b75388d95` (Match Ghostty theme picker startup)
- `f985d2d04` (Harden cmux theme override writes)
- Files:
- `build.zig`
- `src/cli/list_themes.zig`
- `src/main_ghostty.zig`
- Summary:
- Adds a `zig build cli-helper` step so cmux can bundle Ghostty's CLI helper binary on macOS.
- Lets `+list-themes` switch into a cmux-managed mode via env vars, writing the cmux theme override file and posting the existing cmux reload notification for live app-wide preview.
- Fixes the helper-only `app-runtime=none` stdout path so the Ghostty CLI binary builds with the current Zig toolchain.
- Keeps the preview UI readable in light mode, matches upstream picker startup behavior, and hardens writes to the cmux-managed theme override file.

The fork branch HEAD is now the section 7 cmux theme picker helper commit.
### 5) Color scheme mode 2031 reporting

- Commits:
- `2be58ee0e` (Fix DECRPM mode 2031 reporting wrong color scheme)
- `74709c29b` (Send initial color scheme report when mode 2031 is enabled)
- Files:
- `src/Surface.zig`
- `src/termio/stream_handler.zig`
- Summary:
- Keeps Ghostty's mode 2031 color-scheme response aligned with the surface's actual conditional state after config reloads.
- Sends the initial DSR 997 report as soon as mode 2031 is enabled, which cmux relies on for immediate color-scheme awareness.

### 6) Keyboard copy mode selection C API

- Commit: `0b231db94` (Re-export cmux selection APIs removed from upstream)
- Files:
- `include/ghostty.h`
- `src/Surface.zig`
- `src/apprt/embedded.zig`
- Summary:
- Restores `ghostty_surface_select_cursor_cell` and `ghostty_surface_clear_selection`.
- Keeps cmux keyboard copy mode working against the refreshed Ghostty base after upstream removed those exports.

The fork branch HEAD is now the section 6 copy-mode compatibility commit.

## Upstreamed fork changes

Expand All @@ -113,21 +111,24 @@ The fork branch HEAD is now the section 7 cmux theme picker helper commit.

These files change frequently upstream; be careful when rebasing the fork:

- `src/terminal/osc/parsers.zig`
- Upstream uses `std.testing.refAllDecls(@This())` in `test {}`.
- Ensure `iterm2` import stays, and keep `kitty_notification` import added by us.

- `src/terminal/osc.zig`
- OSC dispatch logic moves often. Re-check the integration points for the OSC 99 parser.
- OSC dispatch logic moves often. Re-check the integration points for the OSC 99 parser and keep
the newer `capture`/`captureTrailing()` API usage intact.

- `src/shell-integration/zsh/ghostty-integration`
- Prompt marker handling is easy to regress when upstream adjusts zsh redraw behavior. Keep the
`OSC 133;A` vs `OSC 133;P` split intact for redraw-heavy themes. Pure-style `\n%{\r%}`
prompt newlines should not get an extra explicit continuation marker after the hidden CR.
- `src/terminal/osc/parsers.zig`
- Ensure `kitty_notification` stays imported after upstream parser reorganizations.

- `src/cli/list_themes.zig`
- cmux now relies on the upstream picker UI plus local env-driven hooks for live preview and restore.
If upstream reorganizes the preview loop or key handling, re-check the cmux mode path and keep the
stock Ghostty behavior unchanged when the cmux env vars are absent.

- `build.zig`
- Upstream's new wasm/libghostty work touched the same build graph. Keep the cmux-only `cli-helper`
step wired in without regressing the upstream `lib-vt` or wasm build paths.

- `include/ghostty.h`, `src/Surface.zig`, `src/apprt/embedded.zig`
- Upstream removed cmux-used selection exports. Preserve the re-exported
`ghostty_surface_select_cursor_cell` and `ghostty_surface_clear_selection` functions.

If you resolve a conflict, update this doc with what changed.
2 changes: 1 addition & 1 deletion ghostty
Submodule ghostty updated 422 files
1 change: 1 addition & 0 deletions scripts/ghosttykit-checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ c47010b80cd9ae6d1ab744c120f011a465521ea3 d6904870a3c920b2787b1c4b950cfdef232606b
312c7b23a7c8dc0704431940d76ba5dc32a46afb ae73cb18a9d6efec42126a1d99e0e9d12022403d7dc301dfa21ed9f7c89c9e30
404a3f175ba6baafabc46cac807194883e040980 bcbd2954f4746fe5bcb4bfca6efeddd3ea355fda2836371f4c7150271c58acbd
bc9be90a21997a4e5f06bf15ae2ec0f937c2dc42 6b83b66768e8bba871a3753ae8ffbaabd03370b306c429cd86c9cdcc8db82589
0b231db94bb4adccf34da288790c5e715ae3ca10 dfbea73081fd7cd3b63d2c9c92252a0761aca7ef9d59f0642dca0c0abee84461
Loading