Skip to content

hints: Open links on modifier-click, including in mouse mode - #1863

Closed
aymanbagabas wants to merge 2 commits into
raphamorim:mainfrom
aymanbagabas:hint-click-mouse-mode
Closed

hints: Open links on modifier-click, including in mouse mode#1863
aymanbagabas wants to merge 2 commits into
raphamorim:mainfrom
aymanbagabas:hint-click-mouse-mode

Conversation

@aymanbagabas

@aymanbagabas aymanbagabas commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #1298, reported by @DeflateAwning.

Also reported against a terminal running an altscreen application: cmd+click on a link does nothing, and neither cmd+shift, cmd+ctrl nor cmd+alt opens it either. Three separate defects stack up, and the first one breaks link clicks everywhere, altscreen or not.

WindowEvent::ModifiersChanged only stored the new modifier state. Hint matching runs in CursorMoved, which returns early unless the pointer crosses a cell boundary, so pressing cmd with the pointer already parked on a link never computed a match: highlighted_hint stayed None and the release handler had nothing to activate. The only way to light a link up was to hold cmd and then drag the pointer into a different cell, which is not how anyone clicks a link. ModifiersChanged now recomputes the highlight, guarded on the pointer being inside the text area so a stale grid position cannot produce a phantom match while the pointer sits over the tab strip. This is #1298: that report only names the mouse cursor failing to turn into a pointer until you jiggle the mouse, which is the visible half of the same missing recompute, and the link was equally unclickable at that moment, the reporter just had no way to see it.

Second, mouse mode swallowed the click. In an application that enables mouse tracking (neovim, tmux, lazygit) both the press and the release handler took the mouse_report path, and only shift bypassed it, so the click was forwarded to the application and the hint never fired. The hint mods being held is itself the signal that the user is following a link rather than clicking inside the application, so a left click with a hint highlighted now bypasses reporting the same way shift does. Press and release are gated on the same condition, so the application never sees a press without its matching release.

Third, trigger_hyperlink was dead code. It bailed out unless has_hyperlink_range(), and hyperlink_range is initialised to None and assigned nothing else anywhere in the tree, so the OSC 8 press path could not fire at all. OSC 8 links already reach highlighted_hint through find_hyperlink_at_point, which is what draws the hover underline, so the field, its two accessors, trigger_hyperlink, open_hyperlink and the stale clear block in CursorMoved all go. OSC 8 URIs now open through execute_hint_action like every other match, which routes to the same default handler; resolve_path_for_opening returns None for anything carrying a URI scheme, so the URI is handed over untouched and the behaviour after #1816 is preserved.

Also in here, the pointer cursor no longer sticks. update_highlighted_hints returns true both when a highlight appears and when one is cleared, and the old code set CursorIcon::Pointer on either, leaving a pointer hovering over plain text until the next cell change. The cursor choice moves into Screen::mouse_cursor_icon so the two call sites cannot drift apart again.

Net -27 lines. This is window event wiring with no headless harness, so the existing suite (181 tests in rioterm) only proves the absence of a regression, not the fix; the three root causes above are established by reading the paths rather than by an automated check, and the behaviour wants a click test on a real window before this lands.

#1864 builds on this one: it shows the hovered link's destination in a pill, and depends on the mouse-mode fix here to avoid advertising a link that a click would never reach.

Release Notes:

  • Fixed modifier-click (cmd on macOS, alt elsewhere) never opening a link when the pointer had not crossed a cell boundary since the modifier was pressed.
  • Fixed modifier-click not opening links in applications that capture the mouse, such as neovim and tmux.
  • Fixed the mouse cursor not turning into a pointer until the mouse moved, after holding the hint modifier over a link (Hyperlinks bug: When you hover then press the button, the cursor doesn't change until you move the cursor #1298).
  • Fixed the pointer cursor staying over plain text after leaving a link.

Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
@aymanbagabas
aymanbagabas force-pushed the hint-click-mouse-mode branch from 1959b6f to 46282f7 Compare August 12, 2026 11:20
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.

Hyperlinks bug: When you hover then press the button, the cursor doesn't change until you move the cursor

1 participant