[PR #18347] Add support for tabbing to embedded hyperlinks #31513

Open
opened 2026-01-31 09:47:45 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/18347

State: closed
Merged: Yes


Summary of the Pull Request

There's already logic to tab to a hyperlink when we're in mark mode. We do this by looking at the automatically detected hyperlinks and finding the next one of interest. This adds an extra step afterwards to find any embedded hyperlinks and tab to them too.

Since embedded hyperlinks are stored as text attributes, we need to iterate through the buffer to find the hyperlink and it's buffer boundaries. This PR tries to reduce the workload of that by first finding the automatically detected hyperlinks (since that's a fairly quick process), then using the reduced search area to find the embedded hyperlink (if one exists).

Validation Steps Performed

In PowerShell, add an embedded hyperlink as such:

${ESC}=[char]27
Write-Host "${ESC}]8;;https://github.com/microsoft/terminal${ESC}\This is a link!${ESC}]8;;${ESC}\"

Enter mark mode (ctrl+shift+m) then shift+tab to it.
The "This is a link!" is selected
Verified that this works when searching forwards and backwards

Closes #18310
Closes #15194
Follow-up from #13405
OSC 8 support added in #7251

**Original Pull Request:** https://github.com/microsoft/terminal/pull/18347 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request There's already logic to tab to a hyperlink when we're in mark mode. We do this by looking at the automatically detected hyperlinks and finding the next one of interest. This adds an extra step afterwards to find any embedded hyperlinks and tab to them too. Since embedded hyperlinks are stored as text attributes, we need to iterate through the buffer to find the hyperlink and it's buffer boundaries. This PR tries to reduce the workload of that by first finding the automatically detected hyperlinks (since that's a fairly quick process), then using the reduced search area to find the embedded hyperlink (if one exists). ## Validation Steps Performed In PowerShell, add an embedded hyperlink as such: ```powershell ${ESC}=[char]27 Write-Host "${ESC}]8;;https://github.com/microsoft/terminal${ESC}\This is a link!${ESC}]8;;${ESC}\" ``` Enter mark mode (ctrl+shift+m) then shift+tab to it. ✅ The "This is a link!" is selected ✅ Verified that this works when searching forwards and backwards Closes #18310 Closes #15194 Follow-up from #13405 OSC 8 support added in #7251
claunia added the pull-request label 2026-01-31 09:47:45 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31513