ovis icon indicating copy to clipboard operation
ovis copied to clipboard

Terminal: open a bare file name with Cmd+click (Ctrl+click), as VS Code's terminal does

Open bricks-8 opened this issue 1 month ago • 0 comments

Problem

Agents name files in the terminal without their folders all the time: "rewrote the design doc (11_two-version-design.md, pushed)". In the chat such a name is a link, but in a terminal pane only a path with a folder in it is one, so the file cannot be opened from the terminal at all, even though the server already finds a bare name under the pane's folder.

The terminal leaves bare names alone on purpose: ls and git status print them everywhere, and a click or a tap that only focuses the pane would open the file viewer over the terminal. That reason holds for a plain click, not for a deliberate one.

Proposal

Make a bare file name in a terminal pane a link that only Cmd+click (Ctrl+click off macOS) follows, as VS Code's terminal does.

  • While Cmd or Ctrl is held, a bare name under the pointer is underlined and gets the pointer cursor. Without the key it is drawn and behaves as plain text, so a plain click or a tap still lands on the terminal.
  • Cmd+click opens it in the file viewer, the same way a path with a folder in it opens. The server's existing lookup under the pane's folder answers it, and several matches come back as the list to choose from.
  • Paths with a folder in them keep opening on a plain click, as now.
  • Dotted names that are code, not files (process.env, Math.random), stay text: the CODE_NAME list from filePaths.ts is reused.
  • xterm swaps a provided link's decorations for an object that redraws the link when set, so the links are tracked and their decorations set on keydown, keyup and hover. On window blur the modifier counts as released.
  • A Cmd+click on a link shows the pointer cursor, so the existing onLink check already keeps it from being forwarded to a program that reads the mouse (Claude Code).

It is working on a fork, with unit tests (a bare name opens only with Cmd or Ctrl, its decorations follow the key, a folder path still opens on a plain click): https://github.com/bricks-8/herdr-web-ui/tree/feat/bare-file-name-links

Happy to open it as a PR, or to change the approach first.

Where

Terminal pane (desktop, mouse)

Where it exists today

  • VS Code's integrated terminal: Cmd+click (Ctrl+click) follows a file name or path, underlined while the modifier is held, and searches the workspace for a bare name.
  • iTerm2: Cmd+click opens a file name under the pointer.

Workarounds and alternatives

  • Switching to the chat view, where the same name is a link. It is not there for output that is not a chat message, such as a tool's log.
  • Opening the Files dialog and searching for the name.
  • Making every bare name a plain-click link. That reopens the problem the current rule prevents.

bricks-8 avatar Oct 15 '26 11:10 bricks-8