New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
leonardder opened this Issue Mar 19, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@leonardder
Collaborator

leonardder commented Mar 19, 2018

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.

@leonardder

This comment has been minimized.

Show comment
Hide comment
@leonardder
Collaborator

leonardder commented Mar 19, 2018

@leonardder

This comment has been minimized.

Show comment
Hide comment
@leonardder

leonardder Mar 19, 2018

Collaborator

It also turns out that the rich edit viewer in Inno setup installers supports the ITextDocument interface, while this control is using the RichEdit class that doesn't use iTextDocument. The RichEdit class assumes api 1.0. According to Wikipedia, the text object model should normally be supported for version 1.0 controls.

Collaborator

leonardder commented Mar 19, 2018

It also turns out that the rich edit viewer in Inno setup installers supports the ITextDocument interface, while this control is using the RichEdit class that doesn't use iTextDocument. The RichEdit class assumes api 1.0. According to Wikipedia, the text object model should normally be supported for version 1.0 controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment