Skip to content

Fix Cmd+click links not working inside tmux sessions - #2869

Closed
TomerCohen95 wants to merge 2 commits into
manaflow-ai:mainfrom
TomerCohen95:fix/tmux-link-click
Closed

TomerCohen95 wants to merge 2 commits into
manaflow-ai:mainfrom
TomerCohen95:fix/tmux-link-click

Conversation

@TomerCohen95

@TomerCohen95 TomerCohen95 commented Apr 13, 2026 •

Copy link
Copy Markdown

Summary

  • Fix URLs not being clickable (Cmd+click) when running inside a tmux session with mouse mode enabled (set -g mouse on)
  • Root cause: when tmux enables mouse reporting (mouse_event != .none), Ghostty's link hover detection was completely disabled — over_link was never set to true, so click handling never triggered
  • Fix: allow Ctrl/Super (Cmd on macOS) to bypass mouse capture for link detection, the same way Shift already does, at three code paths in Surface.zig:
    1. Key event handler: pressing Cmd now refreshes link state instead of clearing it
    2. Cursor position callback: holding Cmd during mouse movement triggers link hover detection
    3. Link clearing: set hyperlink_hover dirty flag when leaving a link so the renderer removes the underline immediately (this was a pre-existing bug also visible outside tmux)

Closes #2896

Linked submodule change

Testing

  • Built tagged debug app: ./scripts/reload.sh --tag local-dev --launch
  • Verified inside tmux with set -g mouse on:
    • Cmd+hover over URL → cursor changes to pointer, URL underlines ✓
    • Cmd+click URL → opens in browser ✓
    • Moving mouse away from URL with Cmd held → underline clears ✓
  • Verified no regression outside tmux: Cmd+click links still work normally ✓

Demo Video

N/A — text-only terminal behavior change

Review Trigger (Copy/Paste as PR comment)

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes
  • I updated docs/changelog if needed
  • I requested bot reviews after my latest commit (copy/paste block above or equivalent)
  • All code review bot comments are resolved
  • All human review comments are resolved

Update ghostty submodule to allow Ctrl/Super modifier to bypass mouse
capture for link detection, making URLs clickable in tmux.
@vercel

vercel Bot commented Apr 13, 2026

Copy link
Copy Markdown

@TomercoW is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updated the ghostty git submodule reference to a newer commit and added documentation describing a forked patch that preserves link interactions (Cmd/Ctrl/Super bypass) when mouse reporting is active.

Changes

Cohort / File(s) Summary
Submodule Update
(.gitmodules or submodule commit ref)`
Bumped ghostty submodule from commit 3b684a085d40... to f915b291c8fc... (single-line submodule pointer update).
Docs
docs/ghostty-fork.md
Added Section 9 describing changes in src/Surface.zig: Ctrl/Super (Cmd on macOS) now bypasses mouse capture for link click/hover detection; sets hyperlink_hover dirty flag when leaving links so renderer clears underline promptly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I hopped through commits, a tiny cheer,

Submodule fresh, the path made clear.
Links still click when mice are bold,
Hover underlines freed from hold.
A rabbit's nibble, code untold.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main fix: Cmd+click links not working in tmux, which is the core problem addressed by the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description is well-structured, comprehensive, and covers all key sections including summary, testing details, and checklist.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@greptile-apps

greptile-apps Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Cmd+click link detection inside tmux sessions by extending the existing Shift modifier bypass in Ghostty's src/Surface.zig to also cover Ctrl/Super (Cmd on macOS), allowing link hover detection to work even when tmux has mouse reporting enabled. It also fixes a pre-existing bug where the hyperlink_hover dirty flag was not set when leaving a link, leaving the underline visible until the next redraw.

  • The submodule pointer points to f915b291 which, per the PR description, lives in TomerCohen95/ghostty fix/tmux-link-click — not in manaflow-ai/ghostty main. Per CLAUDE.md and docs/ghostty-fork.md, the commit must be pushed to manaflow-ai/ghostty and be on main before the parent pointer is updated; verify with cd ghostty && git merge-base --is-ancestor HEAD origin/main.
  • docs/ghostty-fork.md is not updated with a new entry for this fork patch, which will make it hard to re-apply the three Surface.zig hunks after a future upstream rebase.

Confidence Score: 3/5

Not safe to merge until the submodule SHA is confirmed to exist in manaflow-ai/ghostty main and docs/ghostty-fork.md is updated

One P1 finding: the submodule pointer may reference a commit only in TomerCohen95/ghostty, violating the documented workflow that requires the SHA to be on manaflow-ai/ghostty main before updating the parent pointer. If merged as-is, git submodule update would fail for all contributors. The underlying Surface.zig fix looks technically sound, but the submodule workflow issue must be resolved first.

ghostty (submodule pointer) and docs/ghostty-fork.md (missing new entry)

Important Files Changed

Filename Overview
ghostty Submodule pointer updated from 3b684a0 to f915b291c8fc547f1a73fe2f32a9dc4d6d8cb385; the new SHA appears to reside only in TomerCohen95/ghostty (not manaflow-ai/ghostty), violating the documented submodule workflow

Sequence Diagram

sequenceDiagram
    participant User
    participant macOS
    participant Ghostty as Ghostty (Surface.zig)
    participant tmux
    participant Shell

    Note over tmux,Shell: tmux mouse mode ON (mouse_event != .none)

    User->>macOS: Hold Cmd key
    macOS->>Ghostty: keyEvent(Cmd)
    Note over Ghostty: Before fix: clear over_link<br/>After fix: refresh link state<br/>(Cmd bypasses mouse capture)

    User->>macOS: Move mouse over URL
    macOS->>Ghostty: cursorPosCallback(x, y, mods.super=true)
    Note over Ghostty: Before fix: skip link detection<br/>(mouse_event != .none blocks it)<br/>After fix: Cmd bypasses → detect link
    Ghostty->>Ghostty: over_link = true, set hyperlink_hover dirty
    Ghostty->>User: URL underlines (cursor → pointer)

    User->>macOS: Cmd+click URL
    macOS->>Ghostty: mouseButtonCallback(Cmd+click)
    Ghostty->>Shell: open URL in browser

    User->>macOS: Move mouse away
    macOS->>Ghostty: cursorPosCallback(x2, y2)
    Note over Ghostty: After fix: set hyperlink_hover dirty<br/>→ renderer clears underline immediately
    Ghostty->>User: Underline clears
Loading

Reviews (1): Last reviewed commit: "Fix Cmd+click links not working inside t..." | Re-trigger Greptile

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Comment thread ghostty
@@ -1 +1 @@
Subproject commit 3b684a085d40ec79e8a0ae863a4f2b48ed4dba74
Subproject commit f915b291c8fc547f1a73fe2f32a9dc4d6d8cb385

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Submodule SHA may not be in manaflow-ai/ghostty

The PR description links the Ghostty changes to TomerCohen95/ghostty on branch fix/tmux-link-click, not to manaflow-ai/ghostty main. CLAUDE.md and docs/ghostty-fork.md both require that the submodule commit be pushed to manaflow-ai/ghostty and reachable from origin/main before the parent repo pointer is updated:

Ghostty changes must be committed in the ghostty submodule and pushed to the manaflow-ai/ghostty fork. Never commit on a detached HEAD or temporary branch — the commit will be orphaned and lost. Verify with: cd ghostty && git merge-base --is-ancestor HEAD origin/main

If SHA f915b291 is only in TomerCohen95/ghostty and hasn't been pushed to manaflow-ai/ghostty main, then after merging, anyone who runs git submodule update will get a fetch error because the configured submodule URL (manaflow-ai/ghostty) doesn't contain the commit.

Comment thread ghostty
@@ -1 +1 @@
Subproject commit 3b684a085d40ec79e8a0ae863a4f2b48ed4dba74
Subproject commit f915b291c8fc547f1a73fe2f32a9dc4d6d8cb385

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 docs/ghostty-fork.md not updated

The fork update checklist in docs/ghostty-fork.md (step 3) requires updating that file with a change summary and any conflict notes for every new fork patch. This PR adds a new entry to the fork (tmux Cmd+click link detection bypass in src/Surface.zig) but docs/ghostty-fork.md is unchanged. Future rebases on upstream won't know to preserve or re-apply the three Surface.zig hunks without this entry.

@vercel

vercel Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Apr 13, 2026 7:30pm

Document the new Surface.zig changes for Cmd+click link detection
through mouse capture, and add merge conflict notes for the affected
code paths.
@TomerCohen95

Copy link
Copy Markdown
Author

Addressing review feedback

@greptile-apps — thanks for the review. Two items addressed:

  1. Submodule pointer — Yes, the pointer currently references TomerCohen95/ghostty since this is a fork PR. The ghostty changes are on the fix/tmux-link-click branch. For merging, the maintainer would apply the single Surface.zig commit to manaflow-ai/ghostty main and update the submodule pointer accordingly.

  2. docs/ghostty-fork.md — Updated in the latest commit with a new section 9 documenting the patch and merge conflict notes for the affected Surface.zig code paths.

CI failures — All from ghosttykit-checksums.txt missing an entry for the new ghostty commit. Expected for fork PRs — the maintainer would add the checksum after applying the ghostty changes to manaflow-ai/ghostty.

@greptile-apps

greptile-apps Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Both concerns are well-addressed:

  1. docs/ghostty-fork.md — Section 9 is properly documented with the commit SHA, affected files, summary of the three code path changes, and merge conflict notes for Surface.zig. This fully satisfies the checklist requirement.

  2. Submodule pointer — The explanation makes sense. This is the expected fork-PR workflow: contributor lands the change in their fork first, maintainer then applies it to manaflow-ai/ghostty main and updates the pointer. The CI failure on ghosttykit-checksums.txt is a natural consequence of that, not a bug in this PR.

From a review standpoint, both issues are resolved. This is ready for maintainer merge once they apply commit f915b291 to manaflow-ai/ghostty main and add the checksum entry.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules and .greptile/config.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
docs/ghostty-fork.md (1)

137-137: Consider adding explicit submodule-main verification at the “patches 1–9” status line.

Small doc hardening: include a one-liner check so future updates avoid detached-head or unpushed-submodule-pointer mistakes.

Suggested doc tweak
-Fork main now carries patches 1–9 plus later upstream merges;
+Fork main now carries patches 1–9 plus later upstream merges
+(verify before bumping parent SHA: `cd ghostty && git merge-base --is-ancestor HEAD origin/main`);
 the current cmux pin is the head listed above.

Based on learnings: "When modifying a submodule (ghostty, vendor/bonsplit, etc.), always push the submodule commit to its remote main branch BEFORE committing the updated pointer in the parent repo... Verify with: cd <submodule> && git merge-base --is-ancestor HEAD origin/main".

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

In `@docs/ghostty-fork.md` at line 137, Add a one-line submodule-main verification
next to the “Fork main now carries patches 1–9” status line: instruct
maintainers to cd into the submodule (e.g., ghostty or vendor/bonsplit) and run
a git merge-base --is-ancestor check to ensure the submodule HEAD is an ancestor
of origin/main (i.e., the submodule commit was pushed to main) before committing
the updated pointer in the parent repo, so contributors avoid detached-head or
unpushed-submodule-pointer mistakes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/ghostty-fork.md`:
- Line 137: Add a one-line submodule-main verification next to the “Fork main
now carries patches 1–9” status line: instruct maintainers to cd into the
submodule (e.g., ghostty or vendor/bonsplit) and run a git merge-base
--is-ancestor check to ensure the submodule HEAD is an ancestor of origin/main
(i.e., the submodule commit was pushed to main) before committing the updated
pointer in the parent repo, so contributors avoid detached-head or
unpushed-submodule-pointer mistakes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aac69595-f0c4-4be7-a510-9b1d84cd22cd

📥 Commits

Reviewing files that changed from the base of the PR and between 048866b and 96294ea.

📒 Files selected for processing (1)
  • docs/ghostty-fork.md

@JoonyoungYi

Copy link
Copy Markdown

Hi, just wanted to add my voice here — I'm running into this exact issue and this fix would be a huge quality-of-life improvement for Claude Code users in cmux. The PR looks solid and the review concerns seem to have been addressed. Would it be possible to get this merged? Really appreciate the work put into this!

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Thanks for this! Cmd-click opens links under mouse reporting, tmux included landed on main in #5406. You opened this first, so you got there first. Closing since main covers it now.

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.

Cmd+click links don't work inside tmux sessions

4 participants