[orca] Improve presentation of all text becoming unselected during caret navigation



commit 33d793ebd5f469a36c1de5194ddd098aa19a796a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Dec 6 13:31:21 2021 +0100

    Improve presentation of all text becoming unselected during caret navigation
    
    If text was selected and then a caret navigation command caused all that
    text to become unselected, we were presenting the text which became
    unselected and not speaking the new location in certain applications.
    The former is chatty, and the latter not helpful. Therefore, when all of
    the text becomes unselected, speak a short "selection removed" message.
    Then present the new location.

 src/orca/messages.py         | 5 +++++
 src/orca/script_utilities.py | 6 ++++++
 2 files changed, 11 insertions(+)
---
diff --git a/src/orca/messages.py b/src/orca/messages.py
index 069190f87..2481ca9e2 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -2145,6 +2145,11 @@ SELECTION_DELETED = _("Selection deleted.")
 # which was just inserted.
 SELECTION_RESTORED = _("Selection restored.")
 
+# Translators: This message is presented to the user when text had been
+# selected in a document and no longer is, e.g. as the result of navigating
+# without holding down the shift key.
+SELECTION_REMOVED = _("Selection removed.")
+
 # Translators: Orca has a command which presents the size and position of the
 # current object in pixels. This string refers to the brief/non-verbose output
 # presented in response to the command. The string substitutions are all for
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index e6d7b8bd4..f5a32bfbb 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -5911,6 +5911,12 @@ class Utilities:
         if self._speakTextSelectionState(len(newString)):
             return True
 
+        # Even though we present a message, treat it as unhandled so the new location is
+        # still presented.
+        if not self.lastInputEventWasCaretNavWithSelection() and oldString and not newString:
+            self._script.speakMessage(messages.SELECTION_REMOVED)
+            return False
+
         changes = []
         oldChars = set(range(oldStart, oldEnd))
         newChars = set(range(newStart, newEnd))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]