From 03ba48afe8b8f17d777cb2f987be4efd2cef4c6c Mon Sep 17 00:00:00 2001 From: Julien Cochuyt Date: Sun, 22 Nov 2020 16:27:21 +0100 Subject: [PATCH] Fix NVDA may freeze when copying large amount of text (#11843) --- source/ui.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/ui.py b/source/ui.py index 6bcab338289..74720c9bbeb 100644 --- a/source/ui.py +++ b/source/ui.py @@ -106,10 +106,16 @@ def reportTextCopiedToClipboard(text: Optional[str] = None): # or the clipboard content did not match what was just copied. message(_("Unable to copy")) return + # Depending on the speech synthesizer, large amount of spoken text can freeze NVDA (#11843) + if len(text) < 1024: + spokenText = text + else: + # Translators: Spoken instead of a lengthy text when copied to clipboard. + spokenText = _("%d characters") % len(text) message( # Translators: Announced when a text has been copied to clipboard. # {text} is replaced by the copied text. - text=_("Copied to clipboard: {text}").format(text=text), + text=_("Copied to clipboard: {text}").format(text=spokenText), # Translators: Displayed in braille when a text has been copied to clipboard. # {text} is replaced by the copied text. brailleText=_("Copied: {text}").format(text=text)