Skip to content

Commit cc1375f

Browse files
authored
Merge 02f94ed into c379885
2 parents c379885 + 02f94ed commit cc1375f

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ def _get_ignoreEditorRevisions(self):
4747
ignoreFormatting=False
4848

4949
def event_caret(self):
50-
curSelectionPos=self.makeTextInfo(textInfos.POSITION_SELECTION)
51-
lastSelectionPos=getattr(self,'_lastSelectionPos',None)
52-
self._lastSelectionPos=curSelectionPos
53-
if lastSelectionPos:
54-
if curSelectionPos._rangeObj.isEqual(lastSelectionPos._rangeObj):
55-
return
50+
self._lastSelectionPos = self.makeTextInfo(textInfos.POSITION_SELECTION)
5651
super(WordDocument,self).event_caret()
5752

5853
def _get_role(self):

source/NVDAObjects/UIA/wordDocument.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
)
3737
from NVDAObjects import NVDAObject
3838
from scriptHandler import script
39+
import api
40+
import eventHandler
3941

4042

4143
"""Support for Microsoft Word via UI Automation."""
@@ -544,14 +546,26 @@ class WordDocument(UIADocumentWithTableNavigation,WordDocumentNode,WordDocumentB
544546
def event_textChange(self):
545547
# Ensure Braille is updated when text changes,
546548
# As Microsoft Word does not fire caret events when typing text, even though the caret does move.
547-
braille.handler.handleCaretMove(self)
549+
# Update braille also when tethered to review, and review position
550+
# if review follows caret.
551+
if not eventHandler.isPendingEvents("caret", self):
552+
eventHandler.queueEvent("caret", self)
548553

549554
def event_UIA_notification(self, activityId=None, **kwargs):
550555
# #10851: in recent Word 365 releases, UIA notification will cause NVDA to announce edit functions
551556
# such as "delete back word" when Control+Backspace is pressed.
552557
if activityId == "AccSN2": # Delete activity ID
553558
return
554559
super(WordDocument, self).event_UIA_notification(**kwargs)
560+
# Try to ensure that braille is updated when UIA is not used and
561+
# ctrl-v, ctrl-x or ctrl-z is pressed.
562+
# Using getFocusObject because self does not work always.
563+
if (
564+
not UIAHandler.shouldUseUIAInMSWord(self.appModule)
565+
and not eventHandler.isPendingEvents("caret", api.getFocusObject())
566+
):
567+
eventHandler.queueEvent("caret", api.getFocusObject())
568+
log.debug(f"{self.appModule.appName}: enqueued caret event")
555569

556570
# The following overide of the EditableText._caretMoveBySentenceHelper private method
557571
# Falls back to the MS Word object model if available.

user_docs/en/changes.t2t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ What's New in NVDA
1818
== Bug Fixes ==
1919
- Reporting of object shortcut keys has been improved. (#10807)
2020
- The SAPI4 synthesizer now properly supports volume, rate and pitch changes embedded in speech. (#15271)
21+
- Braille is updated when control+v, control+x, control+z or backspace is pressed.
22+
It is also updated when typing text, and braille is tethered to review and
23+
review follows caret. (#3276)
2124
-
2225

2326
== Changes for Developers ==

0 commit comments

Comments
 (0)