Skip to content

feat: show link text next to the URL in link-hint mode - #13

Merged
borghei merged 2 commits into
mainfrom
feat/link-hint-captions
Sep 30, 2026
Merged

borghei merged 2 commits into
mainfrom
feat/link-hint-captions

Conversation

@borghei

@borghei borghei commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #8.

The f link-hint popup listed only URLs, so it was hard to tell which entry matched which link in the document. Each row now shows the link's text next to its URL:

│  a  ink project documentation on the web  https://example.com/docs/getting-started/installati… │
│  b  https://x.y                                                                                │
│  c  bold and italic link  https://example.com/b                                                │
  • The caption is the text of the link's consecutive spans, joined across a line wrap.
  • Autolinks, bare URLs and mailto: addresses keep the old single-column row, so a URL is never printed twice.
  • The popup grows from 60 up to 100 columns to fit. When a row is still too long the caption is shortened first, then the URL. Widths are measured in terminal cells, so wide glyphs cannot overflow.
  • The Y copy-URL variant shares the same rows.

Testing

  • 12 new unit tests: caption collection, multi-span and wrapped captions, autolink suppression, dedupe by URL, the a..z cap, a real laid-out markdown snippet, and the row-fitting function.
  • cargo fmt, cargo clippy --all-targets -- -D warnings, cargo test pass locally.
  • Verified in a pty at 100x30: f and f then Y both show captions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UVcvmQrSXd2eyt32g4ko19

The `f` popup listed only URLs, so it was hard to match an entry to the
link it labels. Each row now shows the link's caption (its visible text,
joined across styled spans and line wraps) between the label and the
URL. Autolinks and bare URLs, whose caption would repeat the URL, render
as before. The popup widens to fit (60-100 columns) and truncates the
caption first, then the URL, so rows always fit. The `Y` copy variant
shares the same rows.

Closes #8
@borghei
borghei merged commit c4dcadf into main Sep 30, 2026
7 checks passed
@borghei
borghei deleted the feat/link-hint-captions branch September 30, 2026 23:36
@borghei borghei mentioned this pull request Sep 30, 2026
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.

Request to add link caption when "f" shortcut

1 participant