Try to use window.edit.Edit when an editable window supports it#8165
Conversation
…rts it regardless of window class. Also, try ITextDocument in more cases and remove old pre Windows Vista code Inherrit from RichEdit
michaelDCurran
left a comment
There was a problem hiding this comment.
This pr is rather hard to follow due to the large amount of constants moved to winUser. I understand why you did it, but there are various bits of code here which I'm confused as to why they are removed.
| pDoc=None | ||
| if pDoc: | ||
| self._ITextDocumentObject=pDoc | ||
| self.useITextDocumentSupport=True |
There was a problem hiding this comment.
I will explain this below.
| start=end | ||
| end=watchdog.cancellableSendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,offset) | ||
| return (start,end) | ||
| elif winVersion.winVersion.major<6: #Implementation of standard edit field wordbreak behaviour (only breaks on space) |
There was a problem hiding this comment.
Why is all this code removed?
There was a problem hiding this comment.
Because it is code that would only apply to Windows XP.
| editAPIVersion=0 | ||
| editAPIUnicode=True | ||
| # #4291: Use ITextDocument in Windows 7 and later, as it's very slow in earlier versions. | ||
| useITextDocumentSupport=(winVersion.winVersion.major,winVersion.winVersion.minor)>=(6,1) |
There was a problem hiding this comment.
@michaelDCurran: the useITextDocumentSupport property seems to have been there to limit the support of ITextDocument to windows 7 and abbove. Since we aren't longer supporting Windows versions older than 7, this code now became obsolete (i.e. this variable would be always True). That's also the reason why I removed it from the IAccessible windowless rich text edit support as you saw.
|
One issue I've found from this PR, is moving the mouse while Notepad is open causes a lovely staccato of the error sound. The error it's generating is: ERROR - eventHandler.executeEvent (13:00:27.961): |
|
@Qchristensen commented on 17 Apr 2018, 05:25 CEST:
Fixed in ebfe710 . |
|
That's behaving better, thanks Leonard! |
|
hello. maybe after this pull request i get this i wrote spell checker addon which gets and sets selection. thanks. |
|
Those constants moved from NVDAObjects.window.edit to winUser.
|
|
@michaelDCurran commented on 3 mei 2018 09:04 CEST:
I guess we could revert this change, but as Window.windowTextLineCount relies on one of these constants, the edit module didn't seem to be the right place for it. Add to that the fact that these constants live in winUser.h in the windows SDK. |
|
aah, ok, i will change that in addon itself.
thanks.
…On 5/3/18, Leonard de Ruijter ***@***.***> wrote:
***@***.*****](https://github.com/michaelDCurran) commented on [3 mei
2018 09:04
CEST](#8165 (comment)
"2018-05-03T07:04:57Z - Replied by Github Reply Comments"):
> Those constants moved from NVDAObjects.window.edit to winUser.
I guess we could revert this change, but as Window.windowTextLineCount not
relies on one of these constants, the edit module didn't seem to be the
right place for it. Add to that the fact that these constants live in
winUser.h in the windows SDK.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#8165 (comment)
--
with best regards beqa
|
Fixes #8996 In #8165 we started using Unidentifiededit for editable text fields in which there is a caret and which seems to support Edit API. While both of these criterion's are true for Fast Log Entry edit fields their WindowText contains complete garbage and UnidentifiedEdit relies on Windowtext being correct. Instead: 1. For edit field in Fast Log Entry DisplayModelEditableText is used similar to the pre #8165 2. DisplayModelEditableText no longer inherits from EditableText rather from EditableTextWithoutAutoSelectDetection which makes selection announced when the color used for highlight in a particular app is the default Windows highlight color - This has been suggested by @jcsteh in #4535
…s#11488) Fixes nvaccess#8996 In nvaccess#8165 we started using Unidentifiededit for editable text fields in which there is a caret and which seems to support Edit API. While both of these criterion's are true for Fast Log Entry edit fields their WindowText contains complete garbage and UnidentifiedEdit relies on Windowtext being correct. Instead: 1. For edit field in Fast Log Entry DisplayModelEditableText is used similar to the pre nvaccess#8165 2. DisplayModelEditableText no longer inherits from EditableText rather from EditableTextWithoutAutoSelectDetection which makes selection announced when the color used for highlight in a particular app is the default Windows highlight color - This has been suggested by @jcsteh in nvaccess#4535
* Don't use UnidentifiedEdit for windows with empty windowText Fix-up of #8165 * Update what's new Co-authored-by: Michael Curran <mick@nvaccess.org>
Link to issue number:
Closes #8102
Closes #636
Summary of the issue:
NVDA uses the display model for editable text cases where there is a caret in the window and there doesn't seem to be another overlay class that implements editing. However, NVDA is a bit conservative in this, only using window.edit.Edit for objects with a particular window class or for windowless richEdit.
Description of how this pull request fixes the issue:
When finding an overlay class for an object and there is a caret in the window, rather than directly choosing DisplayModelEditableText, this pr will send the EM_LINELENGTH message to the window. This window message always returns 1 or higher for windows that support the edit API, also for single line edit controls. This means that, when the window responds with >=1 to EM_LINELENGTH, the edit API is supported. In this case, a new UnidentifiedEdit class is used that makes no assumptions about the edit API version. For these controls, this pr will try to construct an ITextDocumentTextInfo object to retrieve text information. If that fails, the implementation will fall back to EditTextInfo.
Testing performed:
Tested the notetab text editor. Instead of using DisplayModelEditableText for the edit control, UnidentifiedEdit is now used, and the control even implements ITextDocument support. Also tested a corporate Delphi application that has edit controls with custom window classes.
Known issues with pull request:
None
Change log entry: