Skip to content

fix(gui): file paths without OSC 7 resolve against the Pane's folder (#377) - #415

Merged
bRRRITSCOLD merged 1 commit into
mainfrom
fix/377-file-path-folder
Nov 24, 2026
Merged

bRRRITSCOLD merged 1 commit into
mainfrom
fix/377-file-path-folder

Conversation

@bRRRITSCOLD

Copy link
Copy Markdown
Owner

Closes #377

What changes

A relative file path in a Pane whose shell sends no OSC 7 (sh, bash without a prompt hook) used to resolve against the Pane's launch folder (cwd), so after a cd it linked to nothing, or to the wrong file. Now:

  1. the folder the shell last reported with OSC 7, as before;
  2. else the Pane's folder as the GUI last read it from the daemon (OSC 7, else /proc/<pid>/cwd, else cwd; since feat(panes): Panes track their current folder #378);
  3. which is the launch folder when the daemon has read nothing else.
  • TerminalView holds the Pane's folder instead of its cwd, and set_folder updates it. paths_dir gives the folder relative paths resolve against, and both hover and click use it.
  • PaneView::update passes a new folder to its terminal, so each reread after changed pane keeps it current.
  • docs/spec.md §11 File paths is rewritten to match.

No route, field or message changes, so API_VERSION stays as it is. The GUI's fake API gets no new operation.

How fresh is the folder?

The daemon reads /proc/<pid>/cwd on the 100 ms tick after a Pane prints, at most once a second. The prompt after a cd is output, so the new folder is known within about a second, and changed pane sends it to the GUI.

I chose not to read the folder again when you click. Whether a secondary-click lands on a link has to be decided right away: it is the same check that draws the underline, and when there is no link the click goes on to the program. A REST read at click time would make that check async. It could also disagree with the underline you saw. The only cost is about a second of lag after the prompt that follows a cd, and the spec now says so.

Tests

  • terminal::view tests (written first and seen failing):
    • should_resolve_against_the_panes_folder_without_osc_7 (new);
    • should_prefer_the_dir_the_shell_reported_to_the_panes_folder (new, so the OSC 7 behavior stays as it was);
    • the existing launch-folder tests cover a Pane whose folder never moved.
  • workspace::tests::panes::should_resolve_file_paths_against_each_panes_folder_as_last_read, over FakeApi: the launch folder at first, then the moved folder after changed pane.
  • cargo xtask ci is green locally.

🤖 Generated with Claude Code

…377)

A relative path in a pane whose shell sends no OSC 7 resolved against the
pane's launch dir, so after a `cd` it linked to nothing or to the wrong
file. The terminal now falls back to the Pane's `folder` as the GUI last
read it (OSC 7, else /proc/<pid>/cwd, else `cwd`), refreshed whenever a
`changed pane` reread brings a new one. OSC 7 the GUI sees still wins.

No click-time read: the link under a click is decided synchronously, as
the underline is drawn, and the daemon's folder lags a `cd` by at most
about a second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bRRRITSCOLD
bRRRITSCOLD merged commit 8b9e65e into main Nov 24, 2026
6 checks passed
@bRRRITSCOLD
bRRRITSCOLD deleted the fix/377-file-path-folder branch November 24, 2026 01:59
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.

File paths in a pane without OSC 7 resolve against its launch folder, not its current folder

1 participant