Skip to content

[Bug]: Clicking to focus the terminal opens log output in the editor as a file path #15757

Description

@tris203

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Run a link-heavy process in the integrated terminal. A Next.js dev server with tRPC is a good example: it logs a request line per call, such as GET /api/trpc/post.list,user.me?batch=1&input=%7B%220%22%3A... 200 in 34ms.
  2. Make the terminal narrow so those request lines wrap across several rows.
  3. Move focus elsewhere (the composer, for example).
  4. Click anywhere in the terminal output to focus it, then press Ctrl+C to stop the server.

Expected behavior

The click focuses the terminal and Ctrl+C stops the process. Nothing opens.

Actual behavior

The focus click frequently opens the preferred editor (VS Code here) on a path that is not a file, such as /api/trpc/post.list,user.me?batch=1&input=.... It looks like Ctrl+C caused it, but the click did.

From reading the code at main @ 18b21325c3:

  • Since fix(web): honor terminal link browser overrides #10060, an unmodified single left click on a detected terminal link activates it (onPointerDown / onPointerUp in apps/web/src/terminal/ghostty/surface.ts). Before that PR it required Ctrl/Cmd.
  • FILE_PATH_PATTERN in apps/web/src/terminal-links.ts treats any token starting with /, and any word/word token, as a path. A logged request route like /api/trpc/...?batch=1&input=... matches in full, query string included.
  • Path links go straight to openInPreferredEditor from handleLinkActivate in apps/web/src/components/ThreadTerminalDrawer.tsx, with no check that the file exists.
  • A wrapped link is one hit target across all of its rows, so a long tRPC URL at narrow width can cover most of the visible terminal.

Together these leave very little terminal area that is safe to click for focus while such a server is running.

Impact

Minor bug or occasional failure

Version or commit

main @ 18b2132

Environment

Linux, VS Code as preferred editor, Next.js dev server with tRPC in the integrated terminal

Workaround

Shift+click to focus (Shift never activates a link), click on blank space, or drag slightly before releasing. There is no setting that disables plain-click activation for paths; "Open links in" only affects URLs.

Possible directions

Leaving the choice to maintainers, but the options I can see:

  • Require Ctrl/Cmd for path links again and keep plain click for URLs.
  • Do not activate a link on the click that gives the terminal focus.
  • Tighten path detection, for example by not treating tokens with a query string as paths, or by checking the file exists before opening the editor.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions