[Feature]: Setting for clicking file paths in the integrated terminal (a plain click currently always opens the external editor, e.g. Cursor)#25589

opened7d agobyMMdSadiqMd

Area

apps/web

Problem

In the integrated terminal, a plain single click on anything detected as a file path opens it in the external "preferred editor" right away. On macOS with Cursor installed, that's Cursor, even if you never chose an editor, because cursor is first in the default EDITORS list (packages/contracts/src/editor.ts:17).

This is easy to trigger by accident:

  • Run pwd and click the output, or click the terminal just to focus it or place the cursor. The whole folder opens in a new Cursor window.
  • Click a path in git status, ls, a stack trace or compiler output while reading it. The editor jumps to the front.
  • Holding ⌘/Ctrl doesn't change anything for paths, because the path branch ignores modifiers. The only ways to click a path without opening the editor are Shift+click or dragging.

Real detector output on main @ 8e1bb037 (extractTerminalLinks, apps/web/src/terminal-links.ts):

Terminal lineDetected link
/Users/me/Developer/my-app (plain pwd output)path → /Users/me/Developer/my-app
~/Developer/my-apppath → ~/Developer/my-app
src/components/App.tsx:42:7 error Unexpected anypath → src/components/App.tsx:42:7
modified: apps/web/src/main.tspath → apps/web/src/main.ts
Local: http://localhost:5173/url → http://localhost:5173/

Every path row opens the external editor on a single unmodified click.

Is this intended? (history)

Yes, but it wasn't designed as a choice for file paths, and it isn't documented:

  1. The original terminal links (ccaa58e393, Feb 2026) required ⌘-click on macOS and Ctrl-click elsewhere. A plain click did nothing (if (!isTerminalLinkActivation(event)) return;). This matches VS Code's terminal, iTerm2 and Ghostty.
  2. #4860 (move to libghostty-vt) kept that requirement.
  3. #10060 ("honor terminal link browser overrides") removed the modifier for all terminal links. Its stated reason was only about URLs: "Terminal links only activated with Ctrl/Cmd, and that modifier could not override an in-app browser preference on Windows." File paths and the external editor aren't mentioned. Plain-click-opens-editor for paths came along with that change.
  4. #15757 reported the editor opening on a click meant to focus the terminal. The triage listed "Require Ctrl/Cmd for path links again" as an option. The fix (#15838) only narrowed what counts as a path, and real paths "keep opening on a plain click."

So the behavior is deliberate, but:

  • It isn't documented. The only related setting, Settings → Integrations → Open links in, says "Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way." That applies to http(s) URLs only, not paths.
  • There's no setting to turn it off or require a modifier.
  • It's inconsistent within T3. Chat file links do the opposite: a plain click opens T3's in-app file viewer, and ⌘/Ctrl+click opens the editor (see the triage in #11403). Terminal paths have no in-app option and no modifier alternative.

Proposed solution

Add a setting for what clicking a file path in the integrated terminal does, next to "Open links in" (Settings → Integrations). For example, "Terminal file paths":

OptionPlain click⌘/Ctrl+click
Open in editor (today's behavior; could stay the default)preferred editorpreferred editor
Require ⌘/Ctrlnothing (focus/select only)preferred editor
Open in T3 Codein-app file viewer, or reveal in the Files panel for directoriespreferred editor (same as chat file links)
Offnothingnothing

Small related improvements:

  • Show the shortcut in the link's hover tooltip ("⌘-click to open in Cursor"), like other terminals do.
  • Consider not opening directories (like pwd output) in the external editor on a plain click, even in the default mode. Opening a whole new editor window is much more disruptive than opening a file.

Implementation pointers (main @ 8e1bb037)

  • apps/web/src/components/ThreadTerminalDrawer.tsx:969-1015: handleLinkActivate. URLs already branch on event.metaKey || event.ctrlKey (forceBrowser), and paths go straight to openTerminalPath → openInPreferredEditor (:1003-1014). This is where the new setting and the modifier check belong.
  • apps/web/src/terminal-links.ts:175-183: isTerminalLinkActivation, the original platform-aware ⌘/Ctrl check, still exported (now used only by markdown-links.ts). It can be reused.
  • apps/web/src/terminal/ghostty/surface.ts:1324-1339, 1564-1577: plain-click link activation on pointer down/up. It can stay as it is if the drawer decides what to do. With "Off", canActivateLink (surface.ts:2020-2023) could return false for paths, so they don't show a hover underline or pointer.
  • packages/contracts/src/settings.ts:259-261, 346: BrowserLinkTarget / browserLinkTarget, a pattern to copy for the new client setting.
  • apps/web/src/components/settings/IntegrationsSettings.tsx:~644: the "Open links in" row. Put the new row next to it, and fix that description so it doesn't suggest it covers terminal paths.
  • apps/web/src/editorPreferences.ts:47-65: the preferred editor is the last one picked in "Open in", or else the first installed entry in EDITORS.

Steps to see the current behavior

  1. Install Cursor (or any supported editor), open a thread, and open the integrated terminal.
  2. Run pwd.
  3. Click once on the printed path. The folder opens in a new Cursor window.
  4. ⌘-click (Ctrl-click) it instead. Same result.

Related

#10060 (removed the modifier), #15757 / #15838 (focus click opened the editor; detection narrowed), #11403 (configurable default action for file links in chat, diffs and the file browser; closed). This request covers the terminal surface, which #11403 didn't.

Version

Behavior present since #10060 (Sep 2026). Confirmed in source on main @ 8e1bb037 and seen on desktop v0.1.2 (macOS, Cursor installed).


Contributions welcome

This is open for anyone who wants to pick it up. The relevant code paths and a suggested design are above. If you'd like to take it, leave a comment so we don't double up, and feel free to ask questions on the issue.

This conversation has been locked.