Repository navigation
fix(gui): file paths without OSC 7 resolve against the Pane's folder (#377) - #415
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #377
What changes
A relative file path in a Pane whose shell sends no OSC 7 (
sh,bashwithout a prompt hook) used to resolve against the Pane's launch folder (cwd), so after acdit linked to nothing, or to the wrong file. Now:folderas the GUI last read it from the daemon (OSC 7, else/proc/<pid>/cwd, elsecwd; since feat(panes): Panes track their current folder #378);TerminalViewholds the Pane'sfolderinstead of itscwd, andset_folderupdates it.paths_dirgives the folder relative paths resolve against, and both hover and click use it.PaneView::updatepasses a newfolderto its terminal, so each reread afterchanged panekeeps it current.docs/spec.md§11 File paths is rewritten to match.No route, field or message changes, so
API_VERSIONstays as it is. The GUI's fake API gets no new operation.How fresh is the folder?
The daemon reads
/proc/<pid>/cwdon the 100 ms tick after a Pane prints, at most once a second. The prompt after acdis output, so the new folder is known within about a second, andchanged panesends 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 acd, and the spec now says so.Tests
terminal::viewtests (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);workspace::tests::panes::should_resolve_file_paths_against_each_panes_folder_as_last_read, overFakeApi: the launch folder at first, then the movedfolderafterchanged pane.cargo xtask ciis green locally.🤖 Generated with Claude Code