Skip to content

Commit 4fdf788

Browse files
authored
Merge 8fbb8d4 into b47fdc5
2 parents b47fdc5 + 8fbb8d4 commit 4fdf788

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
@@ -317,13 +317,16 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
317317
braille.handler.handleCaretMove(self)
318318

319319
@script(
320-
# Translators: a description for a script
321-
description=_("Reports the text of the comment where the system caret is located."),
320+
description=_(
321+
# Translators: a description for a script
322+
"Reports the text of the comment where the system caret is located."
323+
"If pressed twice, presents the information in browse mode."
324+
),
322325
gesture="kb:NVDA+alt+c",
323326
category=SCRCAT_SYSTEMCARET,
324327
speakOnDemand=True,
325328
)
326-
def script_reportCurrentComment(self,gesture):
329+
def script_reportCurrentComment(self, gesture: "inputCore.InputGesture") -> None:
327330
info=self.makeTextInfo(textInfos.POSITION_CARET)
328331
info.expand(textInfos.UNIT_CHARACTER)
329332
fields=info.getTextWithFields(formatConfig={'reportComments':True})
@@ -338,7 +341,15 @@ def script_reportCurrentComment(self,gesture):
338341
except COMError:
339342
break
340343
if text:
341-
ui.message(text)
344+
repeats = scriptHandler.getLastScriptRepeatCount()
345+
if repeats == 0:
346+
ui.message(text)
347+
elif repeats == 1:
348+
ui.browseableMessage(
349+
text,
350+
# Translators: title for Word comment dialog.
351+
_("Comment")
352+
)
342353
return
343354
# Translators: a message when there is no comment to report in Microsoft Word
344355
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
@@ -611,15 +613,28 @@ def _caretMoveBySentenceHelper(self, gesture, direction):
611613
@script(
612614
gesture="kb:NVDA+alt+c",
613615
# Translators: a description for a script that reports the comment at the caret.
614-
description=_("Reports the text of the comment where the system caret is located."),
616+
description=_(
617+
# Translators: a description for a script that reports the comment at the caret.
618+
"Reports the text of the comment where the system caret is located."
619+
" If pressed twice, presents the information in a browsable message"
620+
),
615621
category=SCRCAT_SYSTEMCARET,
616622
speakOnDemand=True,
617623
)
618-
def script_reportCurrentComment(self,gesture):
624+
def script_reportCurrentComment(self, gesture: "inputCore.InputGesture") -> None:
619625
caretInfo=self.makeTextInfo(textInfos.POSITION_CARET)
620626
commentInfo = getCommentInfoFromPosition(caretInfo)
621627
if commentInfo is not None:
622-
ui.message(getPresentableCommentInfoFromPosition(commentInfo))
628+
text = getPresentableCommentInfoFromPosition(commentInfo)
629+
repeats = scriptHandler.getLastScriptRepeatCount()
630+
if repeats == 0:
631+
ui.message(text)
632+
elif repeats == 1:
633+
ui.browseableMessage(
634+
text,
635+
# Translators: title for Word comment dialog.
636+
_("Comment")
637+
)
623638
else:
624639
# Translators: a message when there is no comment to report in Microsoft Word
625640
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
### Changes for Developers

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)