Skip to content

hints: Show the hovered link target in a bottom-left pill - #1864

Open
aymanbagabas wants to merge 1 commit into
raphamorim:mainfrom
aymanbagabas:hint-target-tooltip
Open

hints: Show the hovered link target in a bottom-left pill#1864
aymanbagabas wants to merge 1 commit into
raphamorim:mainfrom
aymanbagabas:hint-target-tooltip

Conversation

@aymanbagabas

@aymanbagabas aymanbagabas commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
image

Rebased onto main now that #1869 has landed, so the diff is the pill alone, one commit against current main.

An OSC 8 link's display text is arbitrary, so its destination stays invisible until you have already opened it. This puts the target in a pill at the bottom-left while the link is hovered, the way a browser status bar does.

Renderer::run already holds the sugarloaf handle and the resolved match text in renderable_content.highlighted_hint, so the whole feature is one rounded_rect plus one text_mut().draw next to the existing search.render, reusing that overlay's primitives and draw order. Rendering is immediate mode, so a frame that does not draw the pill is a frame without one and there is no visibility state to leak. No new file, no struct, no config key, no dependency.

The pill is gated on the click actually landing, not merely on a hint being highlighted. highlighted_hint is recomputed only on cell crossings and modifier changes, so it survives an overlay opening on top of it, and the search overlay, command palette, assistant and quit confirmation each consume the click before the hint handler runs. Advertising a target that cannot be opened would be a lie, so the check runs per frame. This is also why the change belongs above #1863: without it a click in mouse mode never reaches the hint at all.

Truncation keeps the head rather than the tail, the opposite of what search.rs does for its input field, because a URL's scheme and host are what tell you where the click lands. elide_tail takes its measuring function as a parameter, so the binary search is unit tested against a fixed-width stand-in: an off-by-one sweep across every budget from 1 to 39, the zero-width case, and a multibyte string proving the slicing lands on char boundaries.

Verified by hovering a real OSC 8 link whose display text differs from its URI: the pill appears with the destination, and does not appear when nothing is hovered.

Release Notes:

  • The destination of a hovered link is now shown in a pill at the bottom-left of the window.

Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
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.

1 participant