Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use NVDAObjects.window.edit.Edit overlay class for editable windows with window text #8102
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.
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:
Testing reveals that this window message also returns 1 for single line edit controls.
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.