[Follow-up] Polish keyboard navigation to hyperlinks#13494
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Marking for discussion, but drill into the links above folks. The discussion is happening on the original PR. |
Meh it's fine
Leave it as always a feature of Mark Mode, and add it back as a possible setting, so enter on a mouse selection will work, but you can |
|
FYI: this will have a merge conflict with #13659 |
| else | ||
| { | ||
| // Hyperlink is outside of the current view. | ||
| // We need to find if there's a pattern at that location. | ||
| const auto patterns = _activeBuffer().GetPatterns(bufferPos.y, bufferPos.y); | ||
|
|
||
| // NOTE: patterns is stored with top y-position being 0, | ||
| // so we need to cleverly set the y-pos to 0. | ||
| const til::point viewportPos{ bufferPos.x, 0 }; | ||
| const auto results = patterns.findOverlapping(viewportPos, viewportPos); | ||
| if (!results.empty()) | ||
| { | ||
| result = results.front(); | ||
| result->start.y += bufferPos.y; | ||
| result->stop.y += bufferPos.y; | ||
| } | ||
| } |
There was a problem hiding this comment.
Why do we have to handle hyperlinks outside of the viewport?
There was a problem hiding this comment.
Keyboard-based navigation through the buffer looking for links would not be very effective if it was constrained to only working in the visible region :)
There was a problem hiding this comment.
Oh I guess the scrolling is happening in the caller then?
There was a problem hiding this comment.
I guess I didn't think about how this function was used. It's GOOD that it is robust now, but I suppose now that it was never called with coordinates outside the viewport, eh?
There was a problem hiding this comment.
I think given due to #13854 (comment), long-term, we should probably have everything be in the buffer coordinate system. It'll simplify a lot of this extra code. We also need to find hyperlinks outside of the existing viewport. I assume we didn't do that the first time due to performance concerns. :/
|
@msftbot merge this in 10 minutes |
|
Hello @carlos-zamora! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
DHowett
left a comment
There was a problem hiding this comment.
Blocking til after my meeting!
| { | ||
| // Hyperlink is outside of the current view. | ||
| // We need to find if there's a pattern at that location. | ||
| const auto patterns = _activeBuffer().GetPatterns(bufferPos.y, bufferPos.y); |
There was a problem hiding this comment.
what happens when a hyperlink starts above the screen but wraps onto another line? Will we accidentally capture only half of it?
There was a problem hiding this comment.
Welp. Found this out during a bug bash and now it's a line item in #13854. See #13854 (comment) for details on what's going on.
| else | ||
| { | ||
| // Hyperlink is outside of the current view. | ||
| // We need to find if there's a pattern at that location. | ||
| const auto patterns = _activeBuffer().GetPatterns(bufferPos.y, bufferPos.y); | ||
|
|
||
| // NOTE: patterns is stored with top y-position being 0, | ||
| // so we need to cleverly set the y-pos to 0. | ||
| const til::point viewportPos{ bufferPos.x, 0 }; | ||
| const auto results = patterns.findOverlapping(viewportPos, viewportPos); | ||
| if (!results.empty()) | ||
| { | ||
| result = results.front(); | ||
| result->start.y += bufferPos.y; | ||
| result->stop.y += bufferPos.y; | ||
| } | ||
| } |
There was a problem hiding this comment.
I guess I didn't think about how this function was used. It's GOOD that it is robust now, but I suppose now that it was never called with coordinates outside the viewport, eh?
|
And hey, does "selectionPointingAtHyperlink" really mean, "selectionPointingAtHyperlinkAfterHavingBeenHavigatedToInMarkMode"? Or, if you manually select a URL with your mouse, will it update to be true??? |
yeah, it really means "selectionPointingAtHyperlinkAfterHavingBeenHavigatedToInMarkMode". In fact, that's really the only scenario we need to keep track of so that we skip over the hyperlink we're currently on.
This creates a weird corner case that may require further thinking. Right now, ctrl+enter is a mark mode thing. So if you create a selection using your mouse (and even if you modify it using shift+left/right), ctrl+enter won't do anything. You have to enter mark mode to be able to do try and open it as a URL. Perhaps the correct solution here is... Let me know if you agree and I'll move this into #13854 EDIT: eh, I'll just move it there. It's a real problem haha |
|
🎉 Handy links: |
Summary of the Pull Request
Polishes #13405 with some additional feedback found in testing and post-mortem reviews. Such feedback includes:
_isTargetingUrlReferences
Original PR: #13405
Relevant issue: #6649
Epic: #4993