Skip to content
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

Enhance Microsoft Word Comment Command: Press Twice to Present Comment Content in Browsable message. #16800

Merged
merged 12 commits into from
Jul 12, 2024
17 changes: 14 additions & 3 deletions source/NVDAObjects/IAccessible/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,11 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
braille.handler.handleCaretMove(self)

@script(
# Translators: a description for a script
description=_("Reports the text of the comment where the system caret is located."),
description=_(
# Translators: a description for a script
"Reports the text of the comment where the system caret is located."
"If pressed twice, presents the information in browse mode."
),
gesture="kb:NVDA+alt+c",
category=SCRCAT_SYSTEMCARET,
speakOnDemand=True,
Expand All @@ -338,7 +341,15 @@ def script_reportCurrentComment(self,gesture):
except COMError:
break
if text:
ui.message(text)
repeats = scriptHandler.getLastScriptRepeatCount()
if repeats == 0:
ui.message(text)
elif repeats == 1:
ui.browseableMessage(
text,
# Translators: title for Word comment dialog.
_("Comment")
)
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
return
# Translators: a message when there is no comment to report in Microsoft Word
ui.message(_("No comments"))
Expand Down
17 changes: 15 additions & 2 deletions source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import enum
from comtypes import COMError
import mathPres
import scriptHandler
from scriptHandler import isScriptWaiting
import textInfos
import UIAHandler
Expand Down Expand Up @@ -611,15 +612,27 @@ def _caretMoveBySentenceHelper(self, gesture, direction):
@script(
gesture="kb:NVDA+alt+c",
# Translators: a description for a script that reports the comment at the caret.
description=_("Reports the text of the comment where the system caret is located."),
description=_(
# Translators: a description for a script that reports the comment at the caret.
"Reports the text of the comment where the system caret is located."
" If pressed twice, presents the information in browse mode"
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
),
category=SCRCAT_SYSTEMCARET,
speakOnDemand=True,
)
def script_reportCurrentComment(self,gesture):
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
caretInfo=self.makeTextInfo(textInfos.POSITION_CARET)
commentInfo = getCommentInfoFromPosition(caretInfo)
if commentInfo is not None:
ui.message(getPresentableCommentInfoFromPosition(commentInfo))
text = getPresentableCommentInfoFromPosition(commentInfo)
repeats = scriptHandler.getLastScriptRepeatCount()
if repeats == 0:
ui.message(text)
elif repeats == 1:
ui.browseableMessage(text,
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
# Translators: title for Word comment dialog.
_("Comment")
)
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
else:
# Translators: a message when there is no comment to report in Microsoft Word
ui.message(_("No comments"))
Expand Down
3 changes: 3 additions & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### New Features

* Microsoft Office:
* Enhance Microsoft Word Comment Command: Press Twice to Present Comment Content in Browsable message. (#16800, @Cary-Rowen)
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved

### Bug Fixes

### Changes for Developers
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,7 @@ The Elements List can list headings, links, annotations (which includes comments

<!-- KC:beginInclude -->
To report any comments at the current caret position, press NVDA+alt+c.
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
Pressing twice shows the information in a window.
cary-rowen marked this conversation as resolved.
Show resolved Hide resolved
<!-- KC:endInclude -->
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.

Expand Down