Same style and previous style navigation: in an empty MS Word document navigating to next same style and next different style gives an runtime error, navigating to previous styles works properly.
Steps to reproduce:
- Open NVDA
- Assign [ and shift+[ for different style navigation
- Assign ] and shift+] for same style navigation
- Open an empty MS word document
- Make sure UIA for MS Word is disabled
- Press the assigned commands for navigating to next and previous text styles
Actual behavior:
NVDA gives a runtime error when attempting to navigate to next different or next same style text.
IO - inputCore.InputManager.executeGesture (22:39:29.904) - winInputHook (10508):
Input: kb(laptop):shift+ü
IO - speech.speech.speak (22:39:29.965) - MainThread (19244):
Speaking ['No previous different style text']
IO - inputCore.InputManager.executeGesture (22:39:31.054) - winInputHook (10508):
Input: kb(laptop):ü
ERROR - scriptHandler.executeScript (22:39:31.122) - MainThread (19244):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x0A1A3A10>> with gesture 'ü'
Traceback (most recent call last):
File "scriptHandler.pyc", line 295, in executeScript
File "browseMode.pyc", line 558, in <lambda>
File "browseMode.pyc", line 516, in _quickNavScript
File "browseMode.pyc", line 2399, in _iterTextStyle
File "textInfos\__init__.pyc", line 756, in moveToCodepointOffset
File "treeInterceptorHandler.pyc", line 234, in collapse
File "NVDAObjects\window\winword.pyc", line 1052, in collapse
RuntimeError
IO - inputCore.InputManager.executeGesture (22:39:31.794) - winInputHook (10508):
Input: kb(laptop):shift+plus
IO - speech.speech.speak (22:39:31.864) - MainThread (19244):
Speaking ['No previous same style text']
IO - inputCore.InputManager.executeGesture (22:39:32.614) - winInputHook (10508):
Input: kb(laptop):plus
ERROR - scriptHandler.executeScript (22:39:32.653) - MainThread (19244):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x0A1A3A10>> with gesture 'plus'
Traceback (most recent call last):
File "scriptHandler.pyc", line 295, in executeScript
File "browseMode.pyc", line 558, in <lambda>
File "browseMode.pyc", line 516, in _quickNavScript
File "browseMode.pyc", line 2399, in _iterTextStyle
File "textInfos\__init__.pyc", line 756, in moveToCodepointOffset
File "treeInterceptorHandler.pyc", line 234, in collapse
File "NVDAObjects\window\winword.pyc", line 1052, in collapse
RuntimeError
Expected behavior:
NVDA should report "no next different style text" or "no next same style text". This works as expected for previous styles commands.
NVDA logs, crash dumps and other attachments:
n/a
System configuration
NVDA installed/portable/running from source:
Installed
NVDA version:
Version: alpha-31612,3d4aOa8f (2024.2.0.31612)
Windows version:
Windows 11 23 H2
Name and version of other software in use when reproducing the issue:
Microsoft 365 MSO (Version 2403 Build 16.0.17425.20176) 64 Bit
Other information about your system:
n/a
Other questions
Does the issue still occur after restarting your computer?
yes
Have you tried any other versions of NVDA? If so, please report their behaviors.
n/a
If NVDA add-ons are disabled, is your problem still occurring?
yes
Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
yes
cc: @mltony this will affect lot of people who are not using UIA for MS Office, so a fix for object model is needed as well.
This is caused by #16172 - for some reason non_UIA textInfo throws exception when colllapse() is called. In some cases it's easy to catch and deal with this, but in this case collapse is called from within moveToCodepointOffset and it's not immediately clear how to fix this on my side. If I have time I'll try to figure out why MSWord implementation raises this error.
This is still reproducible in the last alpha.