Skip to content

fix: correct hyperlink click pipeline on Windows#1471

Open
ZoOtMcNoOt wants to merge 3 commits intoraphamorim:mainfrom
ZoOtMcNoOt:fix/hyperlink-click-pipeline
Open

fix: correct hyperlink click pipeline on Windows#1471
ZoOtMcNoOt wants to merge 3 commits intoraphamorim:mainfrom
ZoOtMcNoOt:fix/hyperlink-click-pipeline

Conversation

@ZoOtMcNoOt
Copy link
Copy Markdown

@ZoOtMcNoOt ZoOtMcNoOt commented Mar 29, 2026

Alt+Click on URLs truncates the protocol ("https://..." -> "tps://...")
when non-ASCII characters precede the link on the same line. Additionally,
OSC 8 hyperlinks don't open on Windows, and clicks can double-fire.

Three root causes in the hint/hyperlink click path:

  1. Regex byte offsets used directly as grid column indices, diverges
    from actual columns when multi-byte chars are present
  2. Hardcoded xdg-open for OSC 8 hyperlink hints (doesn't exist on Windows)
  3. highlighted_hint not cleared after trigger_hyperlink, so both
    press and release handlers fire

Changes:

  • Extract build_byte_to_col() for correct byte-offset-to-column conversion
  • Use the existing default_url_command() (platform-aware) instead of xdg-open
  • Clear the highlighted hint after a successful hyperlink trigger
  • Export default_url_command as pub for cross-crate use

Fixes #1457

Copilot AI review requested due to automatic review settings March 29, 2026 07:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows hyperlink click handling by aligning regex byte offsets with terminal grid columns (for non-ASCII text), using a platform-aware URL opener for OSC 8 hyperlinks, and preventing hyperlink clicks from firing twice.

Changes:

  • Export default_url_command() from backend hints config and reuse it for OSC 8 hyperlink hint actions.
  • Convert regex match byte offsets to grid column indices via build_byte_to_col() to avoid URL truncation when non-ASCII precedes the URL.
  • Clear highlighted_hint after successfully triggering a hyperlink click to prevent press/release double-fire; adds a regression test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
rio-backend/src/config/hints.rs Exposes default_url_command() so frontends can use the same platform-aware URL open command.
frontends/rioterm/src/screen/mod.rs Fixes byte-offset→column mapping for regex hint matching; uses default_url_command() for OSC 8 dummy hint config; adds clear_highlighted_hint() and a regression test.
frontends/rioterm/src/application.rs Clears highlighted hint after a successful hyperlink trigger to avoid double-execution on mouse release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ZoOtMcNoOt ZoOtMcNoOt force-pushed the fix/hyperlink-click-pipeline branch 2 times, most recently from 85108b7 to 72170c4 Compare March 29, 2026 07:44
@ZoOtMcNoOt ZoOtMcNoOt force-pushed the fix/hyperlink-click-pipeline branch from ddd977a to a749912 Compare March 29, 2026 08:48
ZoOtMcNoOt and others added 2 commits March 29, 2026 04:17
The test helper start_with_capacity hardcoded bash as the fallback
shell, which hangs on Windows CI when spawned through conpty. Use
the existing default_shell() which returns powershell on Windows.
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.

bug: Hyperlink protocol corrupted: "https://" becomes "tps://" on Alt+Click

2 participants