vision Rect conversion bug #12424
Labels
component/vision
Framework for assisting users with low vision
good first issue
github features these at https://github.com/nvaccess/nvda/contribute
p4
https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority
quick fix
Milestone
Steps to reproduce:
Open Pycharm and focus on the main text field. Open Python Console and do the following:
from vision.util import getContextRect
from vision.constants import Context
getContextRect(Context.CARET, focus)
Actual behavior:
The following error occurs:
AttributeError: 'RectLTRB' object has no attribute 'toLTRB'
Expected behavior:
return a RectLTRB of the current caret position.
System configuration
NVDA installed/portable/running from source:
running from source, but also occurs on installed and portable versions
NVDA version:
2020.4
Windows version:
windows 10
Name and version of other software in use when reproducing the issue:
NA
Other information about your system:
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.
no
If 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
The bug is kinda obvious when looking at the code. There is just a line
rect.ToLTRB()
and it does not check what kind of rectangle it is. In most cases this rect is a rectLTWH so ToLTRB makes sense.It is easily fixed by an if statement checking whether the rectangle is already LTRB. However, it might be more robust to add the function ToLTRB() to LocationHelper.rectLTRB that returns itself. I kinda suspect that there are more of these bugs lurking arround in the vision framework and just plugging a function ToLTRB() into rectLTRB would spare some if-statements in the vision framework.
The text was updated successfully, but these errors were encountered: