-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Update braille when control+v, control+x, control+y, control+z, backspace or control+backspace is pressed and UIA not used in ms word #15491
Changes from 4 commits
6c911ac
3d08f47
2dadf66
823daf6
02f94ed
3a96c9d
6aa015e
8bc8c01
94be5c7
2e4c574
847ed52
e79c17f
89ab7d8
db5b953
63d476a
3f24e56
96e814f
542e1b1
40b6e8a
ca9c4dd
357e88d
1af7bfe
31afc49
7cdefd1
31f2703
d3c7cf4
c1ba916
be7ca0f
c56fed9
269120c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ | |
) | ||
from NVDAObjects import NVDAObject | ||
from scriptHandler import script | ||
import api | ||
import eventHandler | ||
|
||
|
||
"""Support for Microsoft Word via UI Automation.""" | ||
|
@@ -544,14 +546,26 @@ class WordDocument(UIADocumentWithTableNavigation,WordDocumentNode,WordDocumentB | |
def event_textChange(self): | ||
burmancomp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Ensure Braille is updated when text changes, | ||
# As Microsoft Word does not fire caret events when typing text, even though the caret does move. | ||
braille.handler.handleCaretMove(self) | ||
# Update braille also when tethered to review, and review position | ||
# if review follows caret. | ||
if not eventHandler.isPendingEvents("caret, self"): | ||
burmancomp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
eventHandler.queueEvent("caret", self) | ||
|
||
def event_UIA_notification(self, activityId=None, **kwargs): | ||
# #10851: in recent Word 365 releases, UIA notification will cause NVDA to announce edit functions | ||
# such as "delete back word" when Control+Backspace is pressed. | ||
if activityId == "AccSN2": # Delete activity ID | ||
return | ||
super(WordDocument, self).event_UIA_notification(**kwargs) | ||
# Try to ensure that braille is updated when UIA is not used and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is a good idea to do this here. There must be another event we're missing, and if not, it's simply a bug in Word that needs to be reported and fixed on their end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that sometimes event_caret (IAccessible\winword.py) is fired when control+z is pressed and sometimes not. UIA_notification event seems to be fired always. I think I have tried to add textChange (and textInsert/textRemove) events to IAccessible\winword.py but I suppose they are not fired. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you intend this to work for Non UIA cases with this code? If so I think it's a false positive, because this code is not active when UIA is disabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When "Use UI Automation to access Microsoft Word document controls Only when necessary" event_UIA_notification is fired when pressing control+x and control+z. Can reason be that object model is not available for some reason and thus UIA is used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a notification event is fired for undo but neither a caret nor a text change event is fired, this is something Microsoft needs to fix. |
||
# ctrl-v, ctrl-x or ctrl-z is pressed. | ||
burmancomp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Using getFocusObject because self does not work always. | ||
if ( | ||
not UIAHandler.shouldUseUIAInMSWord(self.appModule) | ||
and not eventHandler.isPendingEvents("caret", api.getFocusObject()) | ||
): | ||
eventHandler.queueEvent("caret", api.getFocusObject()) | ||
log.debug(f"{self.appModule.appName}: enqueued caret event") | ||
|
||
# The following overide of the EditableText._caretMoveBySentenceHelper private method | ||
# Falls back to the MS Word object model if available. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to research why this code was ever added. It should be possible to do this with a git blame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelDCurran if super(WordDocument,self).event_caret() is not executed there seems to be problem that braille is not always updated when backspace is pressed (problem should occur at least if backspace is pressed and hold down).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tent to agree with @LeonarddeR that checking with git blame in which commit this was introduced is safer. Would you be able to do this?