-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Avoid unnecessary sleep when handling caret movement to improve responsiveness. #14708
Conversation
See test results for failed build of commit d136d6d9ba |
See test results for failed build of commit c3a719aca5 |
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 to me.
However, apparently it is common for some people to hold down commands like downArrow or control+downArrow in large documents to skim the structure or something. We had had reports in the past of freezes or keys being locked down when this code is touched. I think you removed the yield? Have you done any testing in scenarios like these?
@michaelDCurran |
I have tested quite a bit with holding down the downArrow key. I haven't tested with control+downArrow though. I'll do that. It sounds like I should also test with control+shift+downArrow based on #11478. |
I've just held down control+downArrow and control+shift+downArrow for a long time in a pretty long document and didn't encounter any freeze or anything like that. Still, I'll watch out for it while using it in daily work. |
Might also improve the behavior described in #13484. |
I doubt it. This PR is about improving the response time between pressing a key and NVDA checking whether the cursor has moved. That issue sounds like it's more about NVDA not being able to get correct info from the editor for somereason. If anything, that issue probably requires a slower response time. |
thank you for this, i also have some delay with pressing keys and getting responce from nvda sometimes, i hope this will fix that problem: thanks? |
This PR makes tracking of deleted characters in UIA Word much less reliable:
|
Is this with the latest commit in this branch? If so, we might need to raise
|
To explain this further, we previously had a retry interval of 0.01 and we just kept multiplying that by the number of retries to calculate the elapsed time; e.g. 0.01, 0.02, 0.03, etc. The problem is that because of the Windows timer resolution, this could be quite inaccurate. If each sleep took 16 ms instead of 10 ms, the elapsed time for 3 tries would be 0.048, 18 ms longer than we calculated. |
Yes it was. Initial testing with 0.03 looks promising, but I'll run with it for a while to be sure. |
Thanks for the update @jcsteh – so far so good with 0.03! |
@jcsteh Found aanother bug with the latest commit in this branch:
Expected: NVDA reports "c", "b", "a". Actual: NVDA reports "c", "b". |
I couldn't reproduce the search bug exactly as you described. However, I did see intermittent failures when backspacing. To address this, I've had to raise the event timeout even higher to 60 ms. It looks like that control responds very slowly, both in firing events and in processing queries. Not only did our elapsed time previously not account for sleep inaccuracy, it also didn't account for query time. I'm actually not quite sure why we have that event timeout at all. I looked at the various pull requests which introduced the caret event changes for UIA, but I don't see a justification for the event timeout. |
@codeofdusk is the explorer search field working okay for you now with the latest fix from @jcsteh ? |
@michaelDCurran Yes, it does appear to work now! |
Fixes #14983 Fixes #12200 Fixes #12108? Summary of the issue: Moving rapidly in Excel can result in lagging one cell behind when reporting focus. Description of user facing changes Rapid movement in Excel will now always report the last cell. Description of development approach First and foremost, NVDA was relying on the current focus object to cache the current selection in Excel rather than getting the current selection before executing the gesture. This resulted in the one behind behavior. There was logic to check for selection changes, but it detected a change based on the wrong old selection. I also revamped the logic a bit based on #14708, i.e. perform three attempts before doing a time.sleep.
…hange events (#15377) Fixes #15230 Summary of the issue: NVDA's calculation announcements for Win32 calculator relies on a list of predefined keyboard commands, which, when pressed, causes the new value of the display to be announced. This assumes that at the time when gesture is sent the calculator had enough time to process it, and display the result of the calculation. While this worked before prior to #14708, after this PR NVDA no longer sleeps after sending gestures, therefore the value on calculator's display had not enough time to be updated. For users this means that after performing calculations the outdated value was read. Description of user facing changes NVDA once again announces correct results of the calculation. Description of development approach Rather than announcing the display value immediately after user pressed a key, NVDA now sets a flag signaling that the given command causes result of a calculation to appear. This flag is checked in the name change event for the display. If it is set the result is announced and the flag is restored to its default value. While at it I have also updated the copyright header of the module based on its log in VCS.
Fixes #15822. Summary of the issue: With "Handle keys from other applications" enabled, NVDA interferes with certain software which intercepts and re-transmits keyboard commands such as Nudi6.1. For example, this makes it impossible to use backspace while this software is running. Description of user facing changes Backspace now works correctly when using Nudi6.1 with NVDA's "Handle keys from other applications" setting enabled. Description of development approach Before #14708, we delayed slightly when sending keys, which would mean that any keys sent by an app which captured a key sent by NVDA would be ignored during that period. After #14708, we only ignore any keys received while NVDA is sending keys, but that doesn't include any keys captured and sent afterward by, for example, Nudi6.1. This could result in a loop where NVDA kept receiving the key it sent (re-transmitted by the other app) and sending it again. To fix this, we now explicitly wait for the key sent by NVDA (e.g. backspace) to be received by the keyboard hook before we stop ignoring keys and thus return from KeyboardInputGesture.send(). This means that if another application intercepts this key and re-transmits it, we will wait for that re-transmission and ignore it. We use a kernel event so that the notification from the keyboard hook can be handled as quickly as possible without being dependent on the system timer resolution. There is a chance that a key will be intercepted and never re-sent. To deal with this, we wait for a maximum timeout of 10 ms. This means that in the best case scenario, nothing intercepts a key sent by NVDA and we return almost immediately. In the worst case scenario, we wait between 10 and 30 ms (depending on the system timer resolution), which is no worse than the situation before #14708.
) Fixes nvaccess#15822. Summary of the issue: With "Handle keys from other applications" enabled, NVDA interferes with certain software which intercepts and re-transmits keyboard commands such as Nudi6.1. For example, this makes it impossible to use backspace while this software is running. Description of user facing changes Backspace now works correctly when using Nudi6.1 with NVDA's "Handle keys from other applications" setting enabled. Description of development approach Before nvaccess#14708, we delayed slightly when sending keys, which would mean that any keys sent by an app which captured a key sent by NVDA would be ignored during that period. After nvaccess#14708, we only ignore any keys received while NVDA is sending keys, but that doesn't include any keys captured and sent afterward by, for example, Nudi6.1. This could result in a loop where NVDA kept receiving the key it sent (re-transmitted by the other app) and sending it again. To fix this, we now explicitly wait for the key sent by NVDA (e.g. backspace) to be received by the keyboard hook before we stop ignoring keys and thus return from KeyboardInputGesture.send(). This means that if another application intercepts this key and re-transmits it, we will wait for that re-transmission and ignore it. We use a kernel event so that the notification from the keyboard hook can be handled as quickly as possible without being dependent on the system timer resolution. There is a chance that a key will be intercepted and never re-sent. To deal with this, we wait for a maximum timeout of 10 ms. This means that in the best case scenario, nothing intercepts a key sent by NVDA and we return almost immediately. In the worst case scenario, we wait between 10 and 30 ms (depending on the system timer resolution), which is no worse than the situation before nvaccess#14708.
) Fixes nvaccess#15822. Summary of the issue: With "Handle keys from other applications" enabled, NVDA interferes with certain software which intercepts and re-transmits keyboard commands such as Nudi6.1. For example, this makes it impossible to use backspace while this software is running. Description of user facing changes Backspace now works correctly when using Nudi6.1 with NVDA's "Handle keys from other applications" setting enabled. Description of development approach Before nvaccess#14708, we delayed slightly when sending keys, which would mean that any keys sent by an app which captured a key sent by NVDA would be ignored during that period. After nvaccess#14708, we only ignore any keys received while NVDA is sending keys, but that doesn't include any keys captured and sent afterward by, for example, Nudi6.1. This could result in a loop where NVDA kept receiving the key it sent (re-transmitted by the other app) and sending it again. To fix this, we now explicitly wait for the key sent by NVDA (e.g. backspace) to be received by the keyboard hook before we stop ignoring keys and thus return from KeyboardInputGesture.send(). This means that if another application intercepts this key and re-transmits it, we will wait for that re-transmission and ignore it. We use a kernel event so that the notification from the keyboard hook can be handled as quickly as possible without being dependent on the system timer resolution. There is a chance that a key will be intercepted and never re-sent. To deal with this, we wait for a maximum timeout of 10 ms. This means that in the best case scenario, nothing intercepts a key sent by NVDA and we return almost immediately. In the worst case scenario, we wait between 10 and 30 ms (depending on the system timer resolution), which is no worse than the situation before nvaccess#14708.
) Fixes nvaccess#15822. Summary of the issue: With "Handle keys from other applications" enabled, NVDA interferes with certain software which intercepts and re-transmits keyboard commands such as Nudi6.1. For example, this makes it impossible to use backspace while this software is running. Description of user facing changes Backspace now works correctly when using Nudi6.1 with NVDA's "Handle keys from other applications" setting enabled. Description of development approach Before nvaccess#14708, we delayed slightly when sending keys, which would mean that any keys sent by an app which captured a key sent by NVDA would be ignored during that period. After nvaccess#14708, we only ignore any keys received while NVDA is sending keys, but that doesn't include any keys captured and sent afterward by, for example, Nudi6.1. This could result in a loop where NVDA kept receiving the key it sent (re-transmitted by the other app) and sending it again. To fix this, we now explicitly wait for the key sent by NVDA (e.g. backspace) to be received by the keyboard hook before we stop ignoring keys and thus return from KeyboardInputGesture.send(). This means that if another application intercepts this key and re-transmits it, we will wait for that re-transmission and ignore it. We use a kernel event so that the notification from the keyboard hook can be handled as quickly as possible without being dependent on the system timer resolution. There is a chance that a key will be intercepted and never re-sent. To deal with this, we wait for a maximum timeout of 10 ms. This means that in the best case scenario, nothing intercepts a key sent by NVDA and we return almost immediately. In the worst case scenario, we wait between 10 and 30 ms (depending on the system timer resolution), which is no worse than the situation before nvaccess#14708.
Link to issue number:
None.
Summary of the issue:
NVDA frequently takes 30 to 45 ms to respond to cursor movement (arrow keys, etc.) in a text box. This doesn't seem like much, but anything we can do to improve responsiveness here makes for a better experience for the user.
Description of user facing changes
NVDA responds faster when moving the cursor in edit controls.
Description of development approach
This sleep was apparently added to ensure NVDA's keyboard hook ignored the injected keys. In my testing, removing this didn't seem to have any negative impact. If this does turn out to be a problem, we could watch for the last injected key in the keyboard event hook and fire a Windows event when it arrives. This will be faster to wake than a 10-16 ms sleep.
Note that this does alter some class variables in EditableText. However, these were private (underscore prefixed), so I don't think this should be considered API breaking.
Testing strategy:
I used the "time since input" logging to look at the time taken to speak when moving by character in the Run dialog and a simple text box in Firefox. Before this change, this is usually somewhere between 30 and 50 ms. After the change, this is usually somewhere between 20 and 40 ms, though I've seen it go to 10 ms or lower. This is quite variable, so it's hard to be scientific about this. Combined with #14701, this definitely feels snappier to me.
Known issues with pull request:
None.
Change log entries:
Bug fixes
NVDA responds faster when moving the cursor in edit controls.
Code Review Checklist: