Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for tabbing to embedded hyperlinks #18347
base: main
Are you sure you want to change the base?
Add support for tabbing to embedded hyperlinks #18347
Changes from 2 commits
b50ddb1
51b7124
aa612b3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait so if we find a hyperlink we marked up because it looked like a URL regex, we'll then look inside the autodetected one for a manually delimited one?
am I reading that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied Leonard's suggestion to help make searchStart/End more clear.
So, in step 1, the search space spans from our selection to the visible start/end index. We're able to extract a regex match from
_patternIntervalTree
usingfindContained()
. Since we have to pass the search space into that function, we're just calling it over and over again with an expanded search space until we find something.Step 2 has to use a
TextBufferCellIterator
to search through the buffer for a hyperlink attribute. Assuming we already found aresult
in step one, we can reduce the search space to be from our selection to theresult
. (if no result was found, search up to the buffer boundaries*)*additional optimization: use
GetLastNonSpaceCharacter()
as end instead ofbufferSize.End()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq: do we have a way to iterate by attribute instead of by cell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorta, but it makes things more complicated and it's not really worth it imo.
We could use
row.Attributes().runs()
kinda likeTextBuffer::ClearMarksInRange()
here:terminal/src/buffer/out/textBuffer.cpp
Lines 3462 to 3479 in 7423dd3
So we'd be able to get the length of each attribute run, but the combination of search direction (searching backwards with this system is hard) and support for wrapped hyperlinks makes this more complicated than it's worth, imo.