Skip to content

Commit c5f0c4c

Browse files
authored
Merge b9455f8 into 69c8c5b
2 parents 69c8c5b + b9455f8 commit c5f0c4c

4 files changed

Lines changed: 26 additions & 9 deletions

File tree

source/globalCommands.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def script_toggleRightMouseButton(self,gesture):
255255
description=_(
256256
# Translators: Input help mode message for report current selection command.
257257
"Announces the current selection in edit controls and documents. "
258-
"If there is no selection it says so."
258+
"Pressing twice spells this information."
259259
),
260260
category=SCRCAT_SYSTEMCARET,
261261
gestures=("kb(desktop):NVDA+shift+upArrow", "kb(laptop):NVDA+shift+s")
@@ -272,7 +272,13 @@ def script_reportCurrentSelection(self,gesture):
272272
if not info or info.isCollapsed:
273273
speech.speakMessage(_("No selection"))
274274
else:
275-
speech.speakTextSelected(info.text)
275+
scriptCount = scriptHandler.getLastScriptRepeatCount()
276+
if scriptCount == 0:
277+
speech.speakTextSelected(info.text)
278+
elif len(info.text) < speech.speech.MAX_LENGTH_FOR_SELECTION_REPORTING:
279+
speech.speakSpelling(info.text)
280+
else:
281+
speech.speakTextSelected(info.text)
276282

277283
@script(
278284
# Translators: Input help mode message for report date and time command.
@@ -3374,8 +3380,11 @@ def script_braille_cycleShowSelection(self, gesture: inputCore.InputGesture) ->
33743380
ui.message(msg)
33753381

33763382
@script(
3377-
# Translators: Input help mode message for report clipboard text command.
3378-
description=_("Reports the text on the Windows clipboard"),
3383+
description=_(
3384+
# Translators: Input help mode message for report clipboard text command.
3385+
"Reports the text on the Windows clipboard. "
3386+
"Pressing twice spells this information."
3387+
),
33793388
category=SCRCAT_SYSTEM,
33803389
gesture="kb:NVDA+c"
33813390
)
@@ -3389,7 +3398,11 @@ def script_reportClipboardText(self,gesture):
33893398
ui.message(_("There is no text on the clipboard"))
33903399
return
33913400
if len(text) < 1024:
3392-
ui.message(text)
3401+
repeatCount = scriptHandler.getLastScriptRepeatCount()
3402+
if repeatCount == 0:
3403+
ui.message(text)
3404+
elif repeatCount == 1:
3405+
speech.speakSpelling(text)
33933406
else:
33943407
# Translators: If the number of characters on the clipboard is greater than about 1000, it reports this message and gives number of characters on the clipboard.
33953408
# Example output: The clipboard contains a large portion of text. It is 2300 characters long.

source/speech/speech.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,17 +1016,21 @@ def speakSelectionMessage(
10161016
speak(seq, symbolLevel=None, priority=priority)
10171017

10181018

1019+
MAX_LENGTH_FOR_SELECTION_REPORTING = 512
1020+
1021+
10191022
def _getSelectionMessageSpeech(
10201023
message: str,
10211024
text: str,
10221025
) -> SpeechSequence:
1023-
if len(text) < 512:
1026+
if len(text) < MAX_LENGTH_FOR_SELECTION_REPORTING:
10241027
return _getSpeakMessageSpeech(message % text)
10251028
# Translators: This is spoken when the user has selected a large portion of text.
10261029
# Example output "1000 characters"
10271030
numCharactersText = _("%d characters") % len(text)
10281031
return _getSpeakMessageSpeech(message % numCharactersText)
10291032

1033+
10301034
# C901 'speakSelectionChange' is too complex
10311035
# Note: when working on speakSelectionChange, look for opportunities to simplify
10321036
# and move logic out into smaller helper functions.

user_docs/en/changes.t2t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ What's New in NVDA
1212

1313

1414
== Changes ==
15-
15+
- A second press on the commands to report the clipboard or the selection will now spell the reported information. (#15449)
1616

1717
== Bug Fixes ==
1818
- Reporting of object shortcut keys has been improved. (#10807)

user_docs/en/userGuide.t2t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ The actual commands will not execute while in input help mode.
213213
|| Name | Desktop key | Laptop key | Description |
214214
| Say all | ``NVDA+downArrow`` | ``NVDA+a`` | Starts reading from the current position, moving it along as it goes |
215215
| Read current line | ``NVDA+upArrow`` | ``NVDA+l`` | Reads the line. Pressing twice spells the line. Pressing three times spells the line using character descriptions (Alpha, Bravo, Charlie, etc) |
216-
| Read selection | ``NVDA+shift+upArrow`` | ``NVDA+shift+s`` | Reads any selected text |
217-
| Read clipboard text | ``NVDA+c`` | ``NVDA+c`` | Reads any text on the clipboard |
216+
| Read selection | ``NVDA+shift+upArrow`` | ``NVDA+shift+s`` | Reads any selected text. Pressing twice will spell the information |
217+
| Read clipboard text | ``NVDA+c`` | ``NVDA+c`` | Reads any text on the clipboard. Pressing twice will spell the information |
218218

219219
+++ Reporting location and other information +++[ReportingLocation]
220220
|| Name | Desktop key | Laptop key | Description |

0 commit comments

Comments
 (0)