Skip to content

Commit

Permalink
Merge 02f94ed into c379885
Browse files Browse the repository at this point in the history
  • Loading branch information
burmancomp authored Sep 26, 2023
2 parents c379885 + 02f94ed commit cc1375f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 1 addition & 6 deletions source/NVDAObjects/IAccessible/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ def _get_ignoreEditorRevisions(self):
ignoreFormatting=False

def event_caret(self):
curSelectionPos=self.makeTextInfo(textInfos.POSITION_SELECTION)
lastSelectionPos=getattr(self,'_lastSelectionPos',None)
self._lastSelectionPos=curSelectionPos
if lastSelectionPos:
if curSelectionPos._rangeObj.isEqual(lastSelectionPos._rangeObj):
return
self._lastSelectionPos = self.makeTextInfo(textInfos.POSITION_SELECTION)
super(WordDocument,self).event_caret()

def _get_role(self):
Expand Down
16 changes: 15 additions & 1 deletion source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
)
from NVDAObjects import NVDAObject
from scriptHandler import script
import api
import eventHandler


"""Support for Microsoft Word via UI Automation."""
Expand Down Expand Up @@ -544,14 +546,26 @@ class WordDocument(UIADocumentWithTableNavigation,WordDocumentNode,WordDocumentB
def event_textChange(self):
# 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):
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
# ctrl-v, ctrl-x or ctrl-z is pressed.
# 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.
Expand Down
3 changes: 3 additions & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ What's New in NVDA
== Bug Fixes ==
- Reporting of object shortcut keys has been improved. (#10807)
- The SAPI4 synthesizer now properly supports volume, rate and pitch changes embedded in speech. (#15271)
- Braille is updated when control+v, control+x, control+z or backspace is pressed.
It is also updated when typing text, and braille is tethered to review and
review follows caret. (#3276)
-

== Changes for Developers ==
Expand Down

0 comments on commit cc1375f

Please sign in to comment.