[orca] Handle the reported number of text selections being -1



commit 8218ba0cb24071dfc59c2aa72e55563cbee288aa
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Mar 22 13:54:53 2019 -0400

    Handle the reported number of text selections being -1

 src/orca/script_utilities.py   | 2 +-
 src/orca/scripts/default.py    | 4 ++--
 src/orca/scripts/web/script.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 8f6dabbc6..68952df5c 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2464,7 +2464,7 @@ class Utilities:
         except:
             return
 
-        if not text.getNSelections():
+        if text.getNSelections() <= 0:
             caretOffset = text.caretOffset
             startOffset = min(offset, caretOffset)
             endOffset = max(offset, caretOffset)
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index aa7f1abb2..f1d45a258 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2282,7 +2282,7 @@ class Script(script.Script):
             return
 
         self._saveLastCursorPosition(event.source, text.caretOffset)
-        if text.getNSelections():
+        if text.getNSelections() > 0:
             msg = "DEFAULT: Event source has text selections"
             debug.println(debug.LEVEL_INFO, msg, True)
             self.utilities.handleTextSelectionChange(event.source)
@@ -3056,7 +3056,7 @@ class Script(script.Script):
 
         # If there is a selection, clear it. See bug #489504 for more details.
         #
-        if text.getNSelections():
+        if text.getNSelections() > 0:
             text.setSelection(0, context.currentOffset, context.currentOffset)
 
     def inSayAll(self):
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 07c415497..fb4fcfaf7 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -630,7 +630,7 @@ class Script(default.Script):
         """Updates the context and presents the find results if appropriate."""
 
         text = self.utilities.queryNonEmptyText(obj)
-        if not (text and text.getNSelections()):
+        if not (text and text.getNSelections() > 0):
             return
 
         document = self.utilities.getDocumentForObject(obj)


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