-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Consider the GlyphWidth when calculate the postion of matched word in URL detecting #8124
Consider the GlyphWidth when calculate the postion of matched word in URL detecting #8124
Conversation
New misspellings found, please review:
To accept these changes, run the following commands
✏️ Contributor please read thisBy default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
See the 🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The :check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
|
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.
I could've sworn that we had a helper for figuring out how wide a given string is in cells, but I suppose this will work...
Actually, I think I'd be more comfortable if @miniksa had a chance to take a look at this and make sure that the character/glyph width math was being done right here.
@msftbot make sure @miniksa signs off on this |
Hello @zadjii-msft! 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". |
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.
I'm OK with this for now. If it ends up becoming a performance problem, we'll revisit it.
The trick here is that on line 2413, the row.GetCharRow().GetText()
call technically was aware already at that point of the width of every cell in the buffer and stripped that information out to give back a string.
But it has to be in a nice string format for std::wsregex_iterator
to work.
So while I might be like "it's sort of annoying to re-parse the whole string again for the width of every character when we technically already knew that at some point above", I don't think I'm going to hold up this quick fix for that reason.
I think the increased difficulty of performing regex matching against not-a-string OR the carry of additional width data back out when text is retrieved is likely not worth it at this time.
Ehhhh we have like a |
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.
Looks good, thank you!
🎉 Handy links: |
Fix #8121
Summary of the Pull Request
When calculating the position of the matched pattern, consider the width of the characters.
However, if there are some wide glyphs in the detected hyperlink(not possible for now, for the existing regex will not match wide-character?). The repeated character in the tooltip is not fixed by this PR.
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
When calculating the coordinate of the match in #7691, it simply uses the
prefix.size()
as the total prefix width on the screen.This PR fixes that behavior.
Validation Steps Performed
Manually Verified