[orca] Combine some text boundary logic within a single method



commit c3cc9169ed661a227e5e9156e660c6107bccf147
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jul 8 20:07:06 2019 -0400

    Combine some text boundary logic within a single method

 src/orca/mouse_review.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 77a48fb6e..b111723a6 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -177,16 +177,8 @@ class _ItemContext:
         if self._treatAsSingleObject():
             return _StringContext(self._obj, self._script)
 
-        state = self._obj.getState()
-        if self._boundary is not None:
-            boundary = self._boundary
-        elif not state.contains(pyatspi.STATE_SELECTABLE):
-            boundary = pyatspi.TEXT_BOUNDARY_WORD_START
-        else:
-            boundary = pyatspi.TEXT_BOUNDARY_LINE_START
-
         string, start, end = self._script.utilities.textAtPoint(
-            self._obj, self._x, self._y, boundary=boundary)
+            self._obj, self._x, self._y, boundary=self._boundary)
         if string:
             string = self._script.utilities.expandEOCs(self._obj, start, end)
         elif not string and self._script.utilities.isTextArea(self._obj):
@@ -480,6 +472,8 @@ class MouseReviewer:
             boundary = pyatspi.TEXT_BOUNDARY_WORD_START
         elif obj == self._currentMouseOver.getObject():
             boundary = pyatspi.TEXT_BOUNDARY_LINE_START
+        elif obj and obj.getState().contains(pyatspi.STATE_SELECTABLE):
+            boundary = pyatspi.TEXT_BOUNDARY_LINE_START
 
         new = _ItemContext(pX, pY, obj, boundary, window, script)
         if new.present(self._currentMouseOver):


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