Skip to content

MS Word browse mode: modify the internal keyboard handler so that key down events don't acumulate time since input to the infinite #16812

@Adriani90

Description

@Adriani90

Is your feature request related to a problem? Please describe.

In MS Word documents, when using browse mode, holding down the up and down arrow key, or other navigation related key combinations such as ctrl+up and down arrow keys or selecting with shift+up and down arrow keys, cause NVDA to increase the time since input. The longer you hold down the keys, the higher the TSI will be, theoretically it could go to infinite. The time since input means that after releasing the key, NVDA will need x seconds until the last speech sequence from the keydown event starts to be spoken.
This causes a severe performance issue, especially in large documents.
Moreover, if you end up with a very high time since input, then NVDA will not react to any keyboard actions until all speech sequences from the key down event are completely spoken.

Steps to reproduce

  1. Open attached document
    ONKYO.docx
  2. With NVDA running, switch to browse mode
  3. Hold down up or down arrow key for a longer time (e.g. 1 minute). You can do it with ctrl+arrow keys or shift+arrow keys as well

Actual behavior

Time since input increases continuously with every speech sequence, and NVDA puts speech sequences related to other keyboard actions behind the keydown event. This causes severe performance issues. Following error is written to the log after a while:

ERROR - keyboardHandler.internal_keyDownEvent (23:03:03.134) - winInputHook (26320):
internal_keyDownEvent
Traceback (most recent call last):
  File "keyboardHandler.pyc", line 245, in internal_keyDownEvent
  File "inputCore.pyc", line 539, in executeGesture
  File "queueHandler.pyc", line 51, in queueFunction
  File "core.pyc", line 1031, in requestPump
  File "core.pyc", line 850, in queueRequest
  File "monkeyPatches\wxMonkeyPatches.pyc", line 25, in wx_CallAfter_wrapper
  File "winUser.pyc", line 656, in PostMessage
OSError: [WinError 1816] Not enough quota available to process this command.

Keydown event infinite-speech.txt

Expected behavior

The time since input resets to 0 after every speech sequence, and keys are logged properly like it happens in browse mode in Firefox or Chrome. When the key is released, NVDA speaks imediately the last speech sequence where the virtual cursor is without throwing any error about not enough quota.

Describe the solution you'd like

For browse mode, Change the keyboard and the speech manager handler for MS Word to reset time since input to 0 every time after a speech sequence when holding down a key, similar to what happens in MS Word focus mode or in virtual documents in browsers.

Describe alternatives you've considered

fire speech sequence only at current system carret position after the key is released, and not while the key is held down. This should apply for all kinds of carret navigation and also selection key strokes such as shift+arrow keys.

Additional context

Scrolling the screen should still syncronize between browse and focus mode when holding down a key.

Statistics:

  • Holding down up or down arrow key adds up approx. 200-400 ms to the time since input after every speech sequence
  • Holding down ctrl+up or ctrl+down arrow key adds up approx. 50-100 ms to the time since input after every speech sequence
  • Holding down shift+up or shift+down arrow key adds up approx. 100-250 ms to the time since input after every speech sequence

System info

Asus ROG Strix Intel I12900HK 5 GHZ, Grafic NVIDIA GTX 3070TI 8GB dedicated storage, 32 GB DDR

Enironment

Windows 11 23 H2
NVDA alpha-32650,405f9bfa (2024.3.0.32650)
Microsoft 365 MSO (Version 2406 Build 16.0.17726.20078) 64 Bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#prioritytriagedHas been triaged, issue is waiting for implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions