Skip to content

Use NVDAObjects.window.edit.Edit overlay class for editable windows with window text #8102

@LeonarddeR

Description

@LeonarddeR

Description of issue

NVDA uses NVDAObjects.window.edit.Edit for windows with the "edit" window class. The associated TextInfo class is EditTextInfo for non rich edit cases. This NVDAObject class relies on the NVDAObjects.window.Window.windowText to get the text content. For plain text content, this NVDAObject class functions quite well.

For several text windows, NVDA now relies on the display model to get text contents. Examples of those are text controls with specific window classes in delphi applications. Though displayModel.EditableTextDisplayModelTextInfo has the advantage of providing bold, italic and color information, it also has the down side of being unreliable in some cases, especially when inserting or deleting text. It is important to note that, in several delphi text controls I stumbled upon in the wild also expose the text using the windowText property on the object. It is also possible to get selection offsets with the EM_GETSEL window message.

Proposed fix

In Window.findOverlayClasses, before falling back to the DisplayModelEditableText, send the EM_GETLINECOUNT message to the window. If greater than 0, use a new UnidentifiedEdit NVDAObject class instead of the DisplayModelEditableText. The API version for this UnidentifiedEdit class could be set to -1, and the use of iTextDocument should be attempted when constructing a TextInfo for this class. Note the following information about EM_GETLINECOUNT from msdn:

The return value is an integer specifying the total number of text lines in the multiline edit control or rich edit control. If the control has no text, the return value is 1. The return value will never be less than 1.

Testing reveals that this window message also returns 1 for single line edit controls.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions