Skip to content

Sync ghostty fork with upstream main#1226

Open
lawrencecchen wants to merge 12 commits intomainfrom
issue-824-sync-ghostty-fork-upstream
Open

Sync ghostty fork with upstream main#1226
lawrencecchen wants to merge 12 commits intomainfrom
issue-824-sync-ghostty-fork-upstream

Conversation

@lawrencecchen
Copy link
Copy Markdown
Contributor

@lawrencecchen lawrencecchen commented Mar 12, 2026

Summary

Testing

  • cd ghostty && zig build -Demit-xcframework=true -Dxcframework-target=universal -Doptimize=ReleaseFast
  • GHOSTTYKIT_OUTPUT_DIR=/tmp/... GHOSTTYKIT_ARCHIVE_NAME=GhosttyKit.xcframework.tar.gz ./scripts/download-prebuilt-ghosttykit.sh
  • ./scripts/setup.sh
  • ./scripts/reload.sh --tag issue-824-sync-ghostty-fork-upstream

Issues


Summary by cubic

Sync our ghostty fork with upstream main and pin the matching GhosttyKit release. Fix macOS Find shortcut routing (menu-first with command-aware layouts and direct fallback), refocus the Find field on repeated Cmd-F without dismissing the overlay, and keep window chrome opaque; closes #824.

  • Bug Fixes

    • Route macOS Find shortcuts (Cmd-F/G/Shift-Cmd-G/Cmd-E) to the app menu first; honor command-aware layouts; direct fallback to the active Ghostty surface.
    • When Find is already open, refocus the search field on repeated Find; keep the overlay visible; do not repost focus if the field already owns it; restore focus when overlay buttons own it.
    • Keep the titlebar and tab strip opaque even when the terminal background uses alpha.
    • Added regression tests for command-aware routing, menu-first fallback, repeated Find overlay, search-field refocus, and search-focus restore.
  • Dependencies

    • Bump ghostty submodule to current upstream main.
    • Add the matching GhosttyKit xcframework checksum to scripts/ghosttykit-checksums.txt.

Written for commit babb656. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation

    • Updated fork maintenance notes, rebase context, removals, and merge-conflict guidance.
  • New Features

    • Terminal Find shortcut handling with improved Cmd-F/menu routing.
    • Restored keyboard copy-mode selection APIs to preserve copy-mode workflow.
  • Bug Fixes

    • Prevented redundant search-focus reapplication.
    • Mitigated stale-frame flashes during macOS resize (replays last frame).
    • Removed previous no-reflow resize override to keep upstream resize behavior.
  • UI

    • Titlebar and window chrome now rendered fully opaque.
  • Tests

    • Added tests for Find shortcut routing and search-focus behavior.
  • Chores

    • Submodule pointer updated and checksum entry added.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Mar 14, 2026 1:44am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Rebases the ghostty fork onto upstream main (Mar 12, 2026), bumps the ghostty submodule and checksum, updates fork docs and conflict notes, restores copy-mode submodule pointer, changes macOS find/shortcut and focus handling to avoid redundant reposts, and adds related unit tests.

Changes

Cohort / File(s) Summary
Fork Documentation
docs/ghostty-fork.md
Refreshed fork metadata, updated commit hashes, expanded feature sections (OSC 99 kitty parser, CVDisplayLink restart, keyboard copy-mode C API, resize stale-frame mitigation), added "Removed fork changes" and expanded merge-conflict guidance.
Submodule & Checksums
ghostty, scripts/ghosttykit-checksums.txt
Bumped ghostty submodule pointer from a50579bd5... to fbd49738d... and added corresponding SHA256 c9840531... to checksums.
Terminal find / shortcut routing
Sources/AppDelegate.swift, Sources/GhosttyTerminalView.swift, cmuxTests/CmuxWebViewKeyEquivalentTests.swift
Adds layout-aware terminal-find mapping and handler in AppDelegate, integrates handling into Ghostty shortcut path to short-circuit when App handles Cmd‑F variants, and adds tests verifying routing and overlay persistence.
Focus / restore guard
Sources/GhosttyTerminalView.swift, cmuxTests/GhosttySurfaceOverlayTests.swift
Adds guard to restoreSearchFocus to detect when the current firstResponder is the surface search responder (logs and returns early) to prevent redundant refocus; test added.
Window chrome opacity
Sources/ContentView.swift, Sources/Workspace.swift, cmuxTests/GhosttyConfigTests.swift
Forces titlebar/background chrome to opaque (opacity = 1.0); updates bonsplitChromeHex to omit alpha and adjusts tests to expect no alpha component.
Renderer / resize & Surface API notes
src/..., src/Surface.zig, src/apprt/embedded.zig, src/renderer/...
Docs updated to reflect added kitty_notification parser, CVDisplayLink restart, last-frame replay during resize, restored copy-mode C APIs, and files likely to conflict during merge.
Small behavior & wiring changes
Sources/TabManager.swift, Sources/Workspace.swift, Sources/ContentView.swift
Delegates search start to new startOrFocusTerminalSearch helper; updates logging and calling sites to use unified search-start path.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant App as AppDelegate
  participant Ghost as GhosttyNSView
  participant Menu as MainMenu

  User->>App: Press Cmd‑F (key event)
  App->>App: terminalFindShortcutAction(flags, chars, layout)
  alt App maps & handles shortcut
    App->>Ghost: startOrFocusTerminalSearch / trigger binding
    Ghost-->>App: binding executed / focus acknowledged
    App-->>User: return handled (event consumed)
  else App does not handle
    App->>Ghost: forward performKeyEquivalent
    alt Ghost handles
      Ghost-->>User: return handled
    else
      App->>Menu: route keyEquivalent to main menu
      Menu-->>User: perform menu Find action
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I hop through diffs with whiskers bright and keen,
I guard a focused field where Cmd‑F's been seen,
A checksum tucked beneath my paw, so neat,
I skip the needless refocus — oh what a treat! 🐇✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR description includes summary, testing steps, related links, and issue closure. However, the template requires a Demo Video section and completed checklist, which are missing. Add a Demo Video section showing the Find shortcut behavior and window chrome opacity changes. Complete the checklist items (testing locally, tests added, docs updated, bot reviews, resolved comments).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Sync ghostty fork with upstream main' clearly and concisely summarizes the primary objective of the pull request—synchronizing the ghostty fork with the upstream main branch. It is specific, directly related to the changeset, and reflects the main work accomplished.
Linked Issues check ✅ Passed All primary coding objectives from issue #824 are met: the ghostty submodule is synced to upstream main (fbd49738d), cmux-specific patches are reapplied/rebased (OSC 99 parser, Metal resize fix, CVDisplayLink restart, C API), fork documentation is updated, and GhosttyKit checksums are pinned. Additional bug fixes for macOS Find routing, search focus persistence, and chrome opacity are implemented with regression tests.
Out of Scope Changes check ✅ Passed All changes align with issue #824 objectives: submodule sync, fork rebase, checksum pinning, and comprehensive bug fixes (Find routing, search focus, chrome opacity). No unrelated changes detected; all additions directly support the synchronization and listed bug fixes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-824-sync-ghostty-fork-upstream
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR syncs the ghostty submodule from a50579bd5 to fbd49738d (rebased onto upstream main as of March 12, 2026), pins the matching GhosttyKit release checksum, and refreshes the fork documentation to reflect the new commit SHAs and removed patch.

  • Submodule update (ghostty): pointer advanced to fbd49738d8f77fb494883747d34c93e7226f6352, consistent across the submodule entry, checksums file, and docs.
  • Checksum added (scripts/ghosttykit-checksums.txt): new entry fbd49738...c9840531... (valid 64-char SHA-256), correctly formatted for download-prebuilt-ghosttykit.sh.
  • Docs updated (docs/ghostty-fork.md): all per-feature commit SHAs refreshed to match the rebased fork; "Removed fork changes" section added to document the intentional revert of the no-reflow resize override; additional merge-conflict guidance added for src/Surface.zig, src/apprt/embedded.zig, and the renderer files.
  • No logic changes to any scripts or source files; all three changed artifacts are consistent with each other.

Confidence Score: 5/5

  • This PR is safe to merge — it is a clean submodule bump with consistent SHA references, a correctly formatted checksum entry, and thorough documentation.
  • All three changed artifacts (submodule pointer, checksums file, docs) reference the same SHA and are mutually consistent. The new SHA-256 checksum is 64 hex characters and properly formatted for the verification script. No source code or script logic was modified. The docs accurately account for every patch carried, upstreamed, and removed.
  • No files require special attention.

Important Files Changed

Filename Overview
ghostty Submodule pointer advanced from a50579bd5ddec81c6244b9b349d4bf781f667cec to fbd49738d8f77fb494883747d34c93e7226f6352, consistent with the checksums file and docs pin.
scripts/ghosttykit-checksums.txt New SHA-256 entry appended for the updated submodule SHA; hash is 64 hex characters and the format matches what download-prebuilt-ghosttykit.sh expects.
docs/ghostty-fork.md Documentation refreshed: pin SHA updated, all per-feature commit SHAs bumped to match the rebased fork, a new "Removed fork changes" section added for the no-reflow override, and additional merge-conflict guidance added for frequently-changing files.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer runs\ndownload-prebuilt-ghosttykit.sh] --> B{GHOSTTY_SHA\nenv var set?}
    B -- Yes --> C[Use provided SHA]
    B -- No --> D[Read SHA from\ngit submodule HEAD]
    C --> E[Construct TAG:\nxcframework-SHA]
    D --> E
    E --> F[Look up expected SHA-256\nin ghosttykit-checksums.txt]
    F --> G{SHA found\nin checksums?}
    G -- No --> H[Exit 1: Missing\npinned checksum]
    G -- Yes --> I[Download GhosttyKit.xcframework.tar.gz\nfrom GitHub release TAG]
    I --> J[Compute actual SHA-256\nof downloaded archive]
    J --> K{Actual == Expected\nSHA-256?}
    K -- No --> L[Exit 1: Checksum\nmismatch]
    K -- Yes --> M[Extract archive to\nGhosttyKit.xcframework/]
    M --> N[Done ✓]
Loading

Last reviewed commit: 4552e24

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/ghosttykit-checksums.txt`:
- Line 6: The parent repo points the ghostty submodule to commit
fbd49738d8f77fb494883747d34c93e7226f6352 but that commit and the corresponding
GhosttyKit release artifact are missing from the fork; push the missing commit
to the manaflow-ai/ghostty main branch, create a release containing
GhosttyKit.xcframework.tar.gz for that commit, upload the artifact and confirm
its checksum matches the entry in scripts/ghosttykit-checksums.txt
(fbd49738d8f77... -> checksum c9840531e5ef3...), then verify the submodule
pointer in the parent repo still references that pushed commit before
updating/merging the PR.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 875765e5-a5ee-4b07-839d-8cb614dfd4d5

📥 Commits

Reviewing files that changed from the base of the PR and between 968ccf0 and 4552e24.

📒 Files selected for processing (3)
  • docs/ghostty-fork.md
  • ghostty
  • scripts/ghosttykit-checksums.txt

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb65cb1582

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 3586-3592: The test reads NSApp.mainMenu before the shared
application is initialized; move or add initialization of NSApplication.shared
before accessing NSApp.mainMenu in
testCommandFFiresMenuShortcutBeforeGhosttyBinding so the call to NSApp.mainMenu
happens after the app is created (or call the same initialization used by
installMenu(spy:) earlier), ensuring installMenu(spy:) is not relied on to
create the shared app when reading NSApp.mainMenu.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff6a7977-d5aa-4e27-9a53-cb630a39e469

📥 Commits

Reviewing files that changed from the base of the PR and between cb65cb1 and a8cb03a.

📒 Files selected for processing (6)
  • Sources/AppDelegate.swift
  • Sources/ContentView.swift
  • Sources/GhosttyTerminalView.swift
  • Sources/Workspace.swift
  • cmuxTests/CmuxWebViewKeyEquivalentTests.swift
  • cmuxTests/GhosttyConfigTests.swift

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8cb03ae31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 6 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cmuxTests/CmuxWebViewKeyEquivalentTests.swift">

<violation number="1" location="cmuxTests/CmuxWebViewKeyEquivalentTests.swift:3587">
P3: Initialize NSApplication.shared before accessing NSApp.mainMenu so the test doesn’t crash when NSApp is still nil.</violation>
</file>

<file name="Sources/AppDelegate.swift">

<violation number="1" location="Sources/AppDelegate.swift:1719">
P2: Gate keycode fallbacks to cases where no shortcut characters are available; otherwise non‑QWERTY Cmd shortcuts can be misrouted to Find actions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
cmuxTests/CmuxWebViewKeyEquivalentTests.swift (1)

3613-3615: ⚠️ Potential issue | 🟡 Minor

Initialize NSApplication.shared before snapshotting NSApp.mainMenu.

Line 3614 reads NSApp.mainMenu before installMenu(spy:) creates the shared app, so this test stays brittle when run in isolation.

🐛 Suggested fix
     func testCommandFFiresMenuShortcutBeforeGhosttyBinding() {
+        _ = NSApplication.shared
         let previousMenu = NSApp.mainMenu
         defer { NSApp.mainMenu = previousMenu }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 3613 - 3615, The
test reads NSApp.mainMenu before the shared application is created which makes
it flaky; ensure the shared NSApplication is initialized before snapshotting the
menu by invoking NSApplication.shared (or otherwise creating the app via
installMenu(spy:)) prior to reading NSApp.mainMenu in
testCommandFFiresMenuShortcutBeforeGhosttyBinding so the previousMenu capture
happens after the app exists; update the test to call/install the shared app
(e.g., via installMenu(spy:) or _ = NSApplication.shared) before assigning
previousMenu.
🧹 Nitpick comments (2)
cmuxTests/CmuxWebViewKeyEquivalentTests.swift (2)

3672-3673: Assert the Ghostty path stays untouched once the menu consumes Cmd-F.

Lines 3672-3673 only prove the menu action fired. A double-dispatch regression that also forwards Cmd-F into Ghostty would still pass. Reusing the terminal-side debug observer already used elsewhere in this file would make the “before Ghostty binding” part explicit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 3672 - 3673, The
test currently only asserts the app menu handler ran
(XCTAssertTrue(surfaceView.performKeyEquivalent(with: event)) and
spy.invocationCount == 1) but doesn't assert the Ghostty path wasn't also
invoked; update the test to reuse the existing terminal-side debug observer used
elsewhere in this file (the terminal debug observer instance) and assert it did
not receive the Cmd-F dispatch (e.g., its invocation count or lastEvent remains
unchanged) after calling surfaceView.performKeyEquivalent(with: event), ensuring
Ghostty did not get the event once the menu consumed it.

3396-3421: Cover translated Cmd-G / Shift-Cmd-G here too.

terminalFindShortcutAction in Sources/AppDelegate.swift also maps translated g to .next / .previous, but this class only pins the translated f path. A regression in the g branches would still slip through.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 3396 - 3421, Add
tests to cover translated Cmd-G and Shift-Cmd-G in
TerminalFindShortcutActionTests so regressions in the "g" branches of
terminalFindShortcutAction are caught: extend the test class to assert that
terminalFindShortcutAction(flags: [.command], chars: "k", keyCode: <use keyCode
for cmd-g>, layoutCharacterProvider: { _, modifierFlags in
modifierFlags.contains(.command) ? "g" : "k" }) returns .next, and assert that
terminalFindShortcutAction(flags: [.command, .shift], chars: "k", keyCode: <use
keyCode for shift-cmd-g>, layoutCharacterProvider: { _, modifierFlags in
modifierFlags.contains(.command) ? "G" : "k" }) returns .previous; reference the
existing TerminalFindShortcutActionTests and terminalFindShortcutAction to add
these expectations alongside the existing translated-f test so both f and g
translation paths are covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 3613-3615: The test reads NSApp.mainMenu before the shared
application is created which makes it flaky; ensure the shared NSApplication is
initialized before snapshotting the menu by invoking NSApplication.shared (or
otherwise creating the app via installMenu(spy:)) prior to reading
NSApp.mainMenu in testCommandFFiresMenuShortcutBeforeGhosttyBinding so the
previousMenu capture happens after the app exists; update the test to
call/install the shared app (e.g., via installMenu(spy:) or _ =
NSApplication.shared) before assigning previousMenu.

---

Nitpick comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 3672-3673: The test currently only asserts the app menu handler
ran (XCTAssertTrue(surfaceView.performKeyEquivalent(with: event)) and
spy.invocationCount == 1) but doesn't assert the Ghostty path wasn't also
invoked; update the test to reuse the existing terminal-side debug observer used
elsewhere in this file (the terminal debug observer instance) and assert it did
not receive the Cmd-F dispatch (e.g., its invocation count or lastEvent remains
unchanged) after calling surfaceView.performKeyEquivalent(with: event), ensuring
Ghostty did not get the event once the menu consumed it.
- Around line 3396-3421: Add tests to cover translated Cmd-G and Shift-Cmd-G in
TerminalFindShortcutActionTests so regressions in the "g" branches of
terminalFindShortcutAction are caught: extend the test class to assert that
terminalFindShortcutAction(flags: [.command], chars: "k", keyCode: <use keyCode
for cmd-g>, layoutCharacterProvider: { _, modifierFlags in
modifierFlags.contains(.command) ? "g" : "k" }) returns .next, and assert that
terminalFindShortcutAction(flags: [.command, .shift], chars: "k", keyCode: <use
keyCode for shift-cmd-g>, layoutCharacterProvider: { _, modifierFlags in
modifierFlags.contains(.command) ? "G" : "k" }) returns .previous; reference the
existing TerminalFindShortcutActionTests and terminalFindShortcutAction to add
these expectations alongside the existing translated-f test so both f and g
translation paths are covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 866dc741-a3f4-42b3-99fd-3b8bbb2e2372

📥 Commits

Reviewing files that changed from the base of the PR and between a8cb03a and b4fb065.

📒 Files selected for processing (2)
  • Sources/AppDelegate.swift
  • cmuxTests/CmuxWebViewKeyEquivalentTests.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/AppDelegate.swift

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
cmuxTests/CmuxWebViewKeyEquivalentTests.swift (1)

3681-3683: ⚠️ Potential issue | 🟡 Minor

Initialize NSApplication.shared before reading NSApp.mainMenu.

Line 3682 reads NSApp.mainMenu before this test guarantees the shared app exists, so it can still be order-dependent when run in isolation.

Suggested fix
     func testCommandFFiresMenuShortcutBeforeGhosttyBinding() {
+        _ = NSApplication.shared
         let previousMenu = NSApp.mainMenu
         defer { NSApp.mainMenu = previousMenu }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 3681 - 3683, The
test testCommandFFiresMenuShortcutBeforeGhosttyBinding reads NSApp.mainMenu
before ensuring the shared application exists; update the test to initialize the
shared NSApplication first by referencing NSApplication.shared (or calling
NSApplication.shared.activate if appropriate) before accessing NSApp.mainMenu,
then store and restore the previous mainMenu as before; ensure you still use
defer to reset NSApp.mainMenu and keep the rest of the test logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/AppDelegate.swift`:
- Around line 1692-1694: The current code calls
searchFocusNotifier(terminalSurface) whenever terminalSurface.searchState !=
nil, which reposts a .ghosttySearchFocus event; change the logic so that if
terminalSurface.searchState is already non-nil you do not call
searchFocusNotifier and instead just return true (i.e., make it a no-op), and
only invoke searchFocusNotifier when terminalSurface.searchState is nil (or
invert the condition) so repeated Cmd+F does not re-emit focus.

---

Duplicate comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 3681-3683: The test
testCommandFFiresMenuShortcutBeforeGhosttyBinding reads NSApp.mainMenu before
ensuring the shared application exists; update the test to initialize the shared
NSApplication first by referencing NSApplication.shared (or calling
NSApplication.shared.activate if appropriate) before accessing NSApp.mainMenu,
then store and restore the previous mainMenu as before; ensure you still use
defer to reset NSApp.mainMenu and keep the rest of the test logic unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2607ac1b-22cc-4583-8ca9-53f0cf29853a

📥 Commits

Reviewing files that changed from the base of the PR and between b4fb065 and 17fc1e2.

📒 Files selected for processing (3)
  • Sources/AppDelegate.swift
  • Sources/TabManager.swift
  • cmuxTests/CmuxWebViewKeyEquivalentTests.swift

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df42f4ba45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync ghostty fork with upstream ghostty-org/ghostty

1 participant