Skip to content

vision Rect conversion bug #12424

@FalkoBabbage

Description

@FalkoBabbage

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/visionFramework for assisting users with low visiongood first issuegithub features these at https://github.com/nvaccess/nvda/contributep4https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priorityquick fix

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions