-
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
Fix and test TextBuffer::MoveToPreviousWord() #7770
Conversation
Carlos, did this break further with #7677? |
Since this change has to make its way back into windows, I would prefer if you do not make unrelated performance changes at the same time unless they double or triple the performance during a11y. If it's so bad that it's noticeable, let's chat. |
This would also benefit from an explanation as to what the bug ius. |
There are noticeable performance issues with word nav, see #5243 (which might be fixed by this PR as the NVDA review cursor does expand by word). |
No it did not. #7677 had to do with working with a degenerate range at
I feel that. I could leave I did add extra tests to try and alleviate that concern though. And the code looks much cleaner this way. My earlier version of
|
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.
NAK for restructuring.
Since the last edits here introduced a regression and we're close to a Windows bug bar date, I'd like to get this in two separate PRs (bug fix, performance).
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.
This PR does seem to fix #7742 with minor performance improvement to word nav (although could just be placebo)! There are still some noticeable performance issues though at the end of the output. I'll leave code comments to others.
src/buffer/out/textBuffer.hpp
Outdated
@@ -131,7 +131,7 @@ class TextBuffer final | |||
|
|||
const COORD GetWordStart(const COORD target, const std::wstring_view wordDelimiters, bool accessibilityMode = false) const; | |||
const COORD GetWordEnd(const COORD target, const std::wstring_view wordDelimiters, bool accessibilityMode = false) const; | |||
bool MoveToNextWord(COORD& pos, const std::wstring_view wordDelimiters, COORD lastCharPos) const; | |||
bool MoveToNextWord(COORD& pos, const std::wstring_view wordDelimiters, const COORD lastCharPos) const; |
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.
surprised this compiles
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.
derp. Just added it to the cpp too.
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.
The correct way to fix this would be to back out all changes to MoveToNextWord
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 believe I understand -- you cannot move back a word, so you do not change the coordinates.
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.
as noted
@msftbot merge this in 5 minutes |
Hello @DHowett! 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 I think this PR requires a second review from someone with write access. |
Oh and pipelines are failing. |
Yes, indeed. The team has been notified. |
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.
Alright. I had to go dig into what GetWordStart
did because you didn't change it in this PR. But this looks fine to get this fixed. And I'm glad to see the increased test coverage. I'll jump over to the perf one next.
This fix was just released as part of Windows in Insider Build 20236! |
This fixes a bug when moving backwards by word that resulted in #7742. This also includes... - a minor refactor that leverages `GetWordStart` in `MoveToPreviousWord` - additional unit tests for movement by word - a feature test comprised of the referenced bug report `MoveToPreviousWord()` would... - move backwards for each whitespace character - then, move backwards for each regular character This would actually result in moving to the beginning of the current "word" (as defined by a11y). We actually need to do this process twice: - the first time gets you to the beginning of the current word - attempt to move back by one character - the second time gets you to the beginning of the previous word Rather than implementing 4 while loops, we leverage `GetWordStart()` to attempt to move to the beginning of the previous word. We call it twice (as described above). The logic is unchanged, but we instead reuse a function that has already undergone more testing. To make sure this works as expected, additional unit tests were introduced covering "MoveByWord" in the TextBuffer. ## Validation Steps Performed Added test for repro steps. Added unit tests for movement by word. Closes #7742 (cherry picked from commit 9ec57a7)
🎉 Handy links: |
🎉 Handy links: |
This fixes a bug when moving backwards by word that resulted in #7742.
This also includes...
GetWordStart
inMoveToPreviousWord
MoveToPreviousWord()
would...This would actually result in moving to the beginning of the current "word" (as defined by a11y).
We actually need to do this process twice:
Rather than implementing 4 while loops, we leverage
GetWordStart()
toattempt to move to the beginning of the previous word. We call it twice
(as described above). The logic is unchanged, but we instead reuse a
function that has already undergone more testing.
To make sure this works as expected, additional unit tests were
introduced covering "MoveByWord" in the TextBuffer.
Validation Steps Performed
Added test for repro steps.
Added unit tests for movement by word.
Closes #7742