warp icon indicating copy to clipboard operation
warp copied to clipboard

File-link parser captures trailing sentence period, breaking markdown viewer activation

Open cbeaulieu-gt opened this issue 6 months ago • 3 comments

File-link parser captures trailing sentence period, breaking markdown viewer activation

Summary

When a .md file path appears at the end of a sentence in terminal output, Warp's file-link parser includes the trailing . (sentence period) as part of the captured filename. The resulting token ends in .md. rather than .md, so Warp does not recognize it as a markdown file: clicking "Open in Warp" opens the file in a generic text pane with no Editor/Viewer toggle in the pane overflow menu (⋯), and the file appears as raw source instead of rendered markdown.

The Editor/Viewer toggle's absence is the deterministic signal that Warp failed to classify the file as markdown.

Environment

  • OS: Windows
  • Warp channels: reproduced on both Warp Preview and Warp stable
  • Session type: Local (not SSH, not WSL)
  • Terminals tested: multiple terminal instances (rules out per-tab/session state)

Repro

Setup

Create a trivial markdown file:

"# Hello`n`nSome **bold** text" | Set-Content C:\Users\chris\warp-md-test.md

Test cases

Run each line in Warp and click the file-path link it produces. Check the pane overflow menu (⋯) — does the Editor ↔ Viewer toggle appear?

# Command Expected Actual
1 echo "Drafted at C:/Users/chris/warp-md-test.md" (no trailing punct) Toggle present, markdown renders ✅ Works
2 echo "Drafted at C:/Users/chris/warp-md-test.md." (trailing period) Period excluded from link; toggle present; markdown renders ❌ Link captures the trailing .; opens as raw text; no toggle

Case 2 reliably reproduces across fresh Warp tabs, across sessions, and across both Warp Preview and Warp stable. The single-character difference (trailing .) toggles the bug.

Impact

AI assistants, code-review tools, and natural-prose documentation commonly produce sentences like:

Drafted at .tmp/spec.md. The plan is in docs/plan.md. See notes/README.md.

Every .md reference at the end of a sentence is unclickable-to-rendered for this reason. The user has to manually edit the path (strip the period) before clicking, or accept raw text.

Suggested fix

Most terminal link parsers solve this by trimming a closing punctuation set — typically ., ,, ;, :, !, ?, ), ], }, >, ", ' — from the end of a captured path token before extension-classifying it. Trimming . specifically would fix the case here without affecting any legitimate filename (filenames don't end in . on Windows or POSIX).

Related (but distinct) issues

  • #7584 — Markdown viewer design / Editor↔Viewer toggle (closed, shipped). Confirms the intended behavior is rendered markdown with a toggle in the overflow menu.
  • #7683 — Markdown pane hangs on first open. Different failure mode (pane opens as markdown but blank); this bug never engages markdown classification at all.
  • #9091 — .md links not clickable over SSH. Different surface (SSH); this bug is local.
  • #10245 — CJK/full-width punctuation not treated as word boundary. Same class (punctuation boundary), different character set; ASCII trailing-period not covered.

No existing issue matches.

Acceptance criteria

  1. Case 2 in the repro table renders correctly: the trailing . is excluded from the captured link, the markdown viewer engages, and the Editor/Viewer toggle is present in the pane overflow menu.
  2. Highlight-range parity on Windows: when a captured terminal token ends in . and the NT kernel transparently normalizes it away during path resolution, the visible link highlight also excludes the trailing . — matching the POSIX behavior already produced by the SUFFIXES_TO_REMOVE fallback path. Required so the user-visible underline is consistent across operating systems, not just the underlying file classification.

🤖 Generated by Claude Code on behalf of @cbeaulieu-gt

cbeaulieu-gt avatar May 21 '26 14:05 cbeaulieu-gt

@cbeaulieu-gt

Here's what I found while triaging this issue:

Thanks for the clear A/B repro. This appears actionable: the terminal file-link parser should exclude the sentence-ending period before markdown classification so the .md file opens with markdown behavior.

Maintainer details

I concluded that terminal file-link detection appears to include a trailing sentence period in Windows .md paths, causing markdown files opened from terminal output to be classified as non-markdown text..

Triage summary

This looks like an actionable bug in terminal-output file-link detection rather than a markdown viewer rendering failure. The reporter provided a minimal Windows-local repro where C:/Users/chris/warp-md-test.md opens with markdown behavior, while the same path followed by a sentence period is captured as ...warp-md-test.md. and opens as generic text with no Editor/Viewer toggle.

Reproducibility

High. The report includes a deterministic A/B command pair, says the failure reproduces across fresh tabs/sessions and both Stable and Preview, and the current code supports the reported behavior. I could not run a Windows Warp UI repro here, so the estimate is based on the supplied repro plus code inspection.

Likely root cause

Terminal-grid linkification scans possible file paths using GridHandler::possible_file_paths_at_point and splits fragments through is_file_link_separator in app/src/terminal/model/grid/grid_handler.rs. The ASCII separator set includes punctuation like commas, brackets, and quotes, but not .. TerminalView::compute_valid_paths in app/src/terminal/view/link_detection.rs then validates candidates and only strips the Git Bash symlink suffix @, so a sentence-ending dot can remain in the highlighted path.

That differs from rich-content link detection in app/src/util/link_detection.rs, which already adds a trailing-period separator specifically for natural-language file references. If Windows filesystem validation accepts foo.md. as referring to foo.md while the retained PathBuf still ends in .md., markdown classification in crates/warp_util/src/file_type.rs / app/src/util/openable_file_type.rs will not identify it as Markdown. The tooltip path in app/src/terminal/view/tooltips.rs can then offer/open the file through the generic code-editor route instead of the markdown viewer behavior.

Duplicate check

I checked all open non-PR issues and recently closed issues within the last 7 days. Related issues around markdown viewing, SSH .md links, long paths, and generic clickable file-link behavior exist, but I did not find two existing issues matching this trailing ASCII sentence-period capture scenario.

This is my automated analysis and may be incorrect. A maintainer will verify the details.

Powered by Oz

warp-for-oss[bot] avatar May 21 '26 14:05 warp-for-oss[bot]

Thanks for the report. Marking this ready to implement.

kevinchevalier avatar May 26 '26 22:05 kevinchevalier

This issue has been labeled ready-to-implement and is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment @oz-agent on this issue to have the bot draft an implementation PR automatically.

warp-for-oss[bot] avatar May 26 '26 22:05 warp-for-oss[bot]