Summary
Clicking a clickable .html path in the terminal can open the wrong path, and the HTML preview then shows "The system cannot find the path specified. (os error 3)". This happens when the printed absolute path is long enough to wrap across two terminal rows in the (narrow) split preview layout.
Steps to reproduce
- Have an agent print a long absolute path, e.g.
C:\Users\AST\claude\projecten\_index\dashboard.html.
- Use the split HTML-preview layout so the terminal pane is narrow and the path wraps onto a second row.
- Click the path in the terminal.
- The preview shows
... (os error 3) instead of the file. The file itself is fine (opens normally in a browser).
Root cause
The terminal link provider in src/main.js (spawnTerminal → registerLinkProvider) inspects one buffer row at a time:
const ln = term.buffer.active.getLine(y - 1);
const text = ln.translateToString(true);
const re = /([A-Za-z]:\[^\s"'<>|]+?\.html?|[\w.\-\/]+\.html?)/gi;
When a path wraps, the matcher only sees the tail fragment on the second row (e.g. dex\dashboard.html). That fragment matches the relative-path alternative, so openPreviewFile() treats it as relative and prepends the working folder, producing a path that does not exist → read_file fails with os error 3.
Proposed fix
Reconstruct the full logical line before matching:
- From the queried row, walk up while
IBufferLine.isWrapped to find the first row, then collect following wrapped rows.
- Concatenate the rows (column-aligned) into the full logical text and run the regex on that.
- Map each match's character offsets back to
(x, y) cell ranges; for the queried row, return the link segment(s) that fall on it, all with activate opening the full matched path.
This makes clicking any part of a wrapped path open the correct, complete path.
Acceptance criteria
Summary
Clicking a clickable
.htmlpath in the terminal can open the wrong path, and the HTML preview then shows "The system cannot find the path specified. (os error 3)". This happens when the printed absolute path is long enough to wrap across two terminal rows in the (narrow) split preview layout.Steps to reproduce
C:\Users\AST\claude\projecten\_index\dashboard.html.... (os error 3)instead of the file. The file itself is fine (opens normally in a browser).Root cause
The terminal link provider in
src/main.js(spawnTerminal→registerLinkProvider) inspects one buffer row at a time:When a path wraps, the matcher only sees the tail fragment on the second row (e.g.
dex\dashboard.html). That fragment matches the relative-path alternative, soopenPreviewFile()treats it as relative and prepends the working folder, producing a path that does not exist →read_filefails with os error 3.Proposed fix
Reconstruct the full logical line before matching:
IBufferLine.isWrappedto find the first row, then collect following wrapped rows.(x, y)cell ranges; for the queried row, return the link segment(s) that fall on it, all withactivateopening the full matched path.This makes clicking any part of a wrapped path open the correct, complete path.
Acceptance criteria
.htmlpath opens the correct file in the preview (no os error 3).