TASK-166: fix .md preview when Ink hard-wraps a no-space path#1
Open
mpmisha wants to merge 1 commit into
Open
Conversation
Ink-based TUIs (Copilot CLI, Claude Code) hard-wrap long paths and emit the continuation row with layout indent. TASK-132/137's seam-space heuristic could not distinguish that indent from a wrap-eaten literal space, so it always inserted a phantom space at the join (.../files/... became .../fi les/...) and fileRead 404'd silently. Fix: track each inserted seam-space offset during forward and backward hard-newline stitching. In activate(), compute a seam-stripped variant of the matched path and retry fileRead with it if the primary read returns null. Primary is tried first so OneDrive - Microsoft\... paths still resolve normally. Added an e2e regression test plus an installSelectiveFileReadSpy helper that returns content only for the real path, asserting both the primary attempt and the stripped-path fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Problem
When Ink-based TUIs (Copilot CLI, Claude Code) hard-wrap a long
.mdpath that has no embedded spaces, the continuation row starts with Ink's layout indent. The TASK-132/137 seam-space heuristic inTerminalPanel.tsx's .md link provider could not distinguish that indent from a wrap-eaten literal space (as inOneDrive - Microsoft\…), so it always inserted a phantom space at the join —…/files/…became…/fi les/…—fileRead404'd silently and the preview never opened.User repro: shrink a terminal pane narrow enough to wrap a
.mdpath printed by a TUI, click the underlined link — nothing happens. DevTools console shows:Fix
activate(), compute a seam-stripped variant of the matched path. TryfileReadon the primary (with-seam) path first; if it returns null and a stripped variant exists, retry. First success drives the markdownPreview overlay.OneDrive - Microsoft\…paths still succeed on the primary attempt.Tests
Added
phantom seam: hard-newline-wrapped no-space path falls back to stripped path on fileRead nulltotests/e2e/task-107-md-path-wrap-and-spaces.spec.ts, plus a newinstallSelectiveFileReadSpyhelper that returns content only for the real path. The test asserts both that the primary attempt fires first and that the fallback opens the overlay with the correct path.Verification