Skip to content

Commit 5a6bf0e

Browse files
authored
Merge 701b5e2 into 94785fe
2 parents 94785fe + 701b5e2 commit 5a6bf0e

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,16 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
380380
braille.handler.handleCaretMove(self)
381381

382382
@script(
383-
# Translators: a description for a script
384-
description=_("Reports the text of the comment where the system caret is located."),
383+
description=_(
384+
# Translators: a description for a script
385+
"Reports the text of the comment where the system caret is located."
386+
"If pressed twice, presents the information in browse mode."
387+
),
385388
gesture="kb:NVDA+alt+c",
386389
category=SCRCAT_SYSTEMCARET,
387390
speakOnDemand=True,
388391
)
389-
def script_reportCurrentComment(self, gesture):
392+
def script_reportCurrentComment(self, gesture: "inputCore.InputGesture") -> None:
390393
info = self.makeTextInfo(textInfos.POSITION_CARET)
391394
info.expand(textInfos.UNIT_CHARACTER)
392395
fields = info.getTextWithFields(formatConfig={"reportComments": True})
@@ -401,7 +404,15 @@ def script_reportCurrentComment(self, gesture):
401404
except COMError:
402405
break
403406
if text:
404-
ui.message(text)
407+
repeats = scriptHandler.getLastScriptRepeatCount()
408+
if repeats == 0:
409+
ui.message(text)
410+
elif repeats == 1:
411+
ui.browseableMessage(
412+
text,
413+
# Translators: title for Word comment dialog.
414+
_("Comment")
415+
)
405416
return
406417
# Translators: a message when there is no comment to report in Microsoft Word
407418
ui.message(_("No comments"))

source/NVDAObjects/UIA/wordDocument.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
import enum
1313
from comtypes import COMError
14+
import inputCore
1415
import mathPres
16+
import scriptHandler
1517
from scriptHandler import isScriptWaiting
1618
import textInfos
1719
import UIAHandler
@@ -643,15 +645,28 @@ def _caretMoveBySentenceHelper(self, gesture, direction):
643645
@script(
644646
gesture="kb:NVDA+alt+c",
645647
# Translators: a description for a script that reports the comment at the caret.
646-
description=_("Reports the text of the comment where the system caret is located."),
648+
description=_(
649+
# Translators: a description for a script that reports the comment at the caret.
650+
"Reports the text of the comment where the system caret is located."
651+
" If pressed twice, presents the information in a browsable message"
652+
),
647653
category=SCRCAT_SYSTEMCARET,
648654
speakOnDemand=True,
649655
)
650-
def script_reportCurrentComment(self, gesture):
656+
def script_reportCurrentComment(self, gesture: "inputCore.InputGesture") -> None:
651657
caretInfo = self.makeTextInfo(textInfos.POSITION_CARET)
652658
commentInfo = getCommentInfoFromPosition(caretInfo)
653659
if commentInfo is not None:
654-
ui.message(getPresentableCommentInfoFromPosition(commentInfo))
660+
text = getPresentableCommentInfoFromPosition(commentInfo)
661+
repeats = scriptHandler.getLastScriptRepeatCount()
662+
if repeats == 0:
663+
ui.message(text)
664+
elif repeats == 1:
665+
ui.browseableMessage(
666+
text,
667+
# Translators: title for Word comment dialog.
668+
_("Comment")
669+
)
655670
else:
656671
# Translators: a message when there is no comment to report in Microsoft Word
657672
ui.message(_("No comments"))

user_docs/en/changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### New Features
88

9+
* Enhanced Microsoft Word comment command: press twice to present comment content in browsable message. (#16800, @Cary-Rowen)
10+
911
### Bug Fixes
1012

1113
* NVDA once again relies on UIA events for caret movement in XAML and WPF text controls, rather than only on manual querying of the caret position. (#16817, @LeonarddeR)

user_docs/en/userGuide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,8 @@ The Elements List can list headings, links, annotations (which includes comments
14871487
#### Reporting Comments {#WordReportingComments}
14881488

14891489
<!-- KC:beginInclude -->
1490-
To report any comments at the current caret position, press NVDA+alt+c.
1490+
To report any comments at the current caret position, press `NVDA+alt+c`.
1491+
Pressing twice shows the information in a browsable message.
14911492
<!-- KC:endInclude -->
14921493
All comments for the document, along with other tracked changes, can also be listed in the NVDA Elements List when selecting Annotations as the type.
14931494

0 commit comments

Comments
 (0)