[orca] Prevent label inference from infering from text above when examing the current line



commit f83b9ca4876e50ccfab1a80abbbd696e7ca31aaa
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Jan 6 19:08:08 2013 -0500

    Prevent label inference from infering from text above when examing the current line

 src/orca/label_inference.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/label_inference.py b/src/orca/label_inference.py
index df0aa6f..3cc1a04 100644
--- a/src/orca/label_inference.py
+++ b/src/orca/label_inference.py
@@ -273,8 +273,10 @@ class LabelInference:
             if start == None:
                 start = max(0, text.caretOffset)
             else:
-                start = max(0, start - 1)                
+                start = max(0, start - 1)
             string, start, end = text.getTextAtOffset(start, boundary)
+            if string.endswith('\n'):
+                start = end
 
         rv = self._script.utilities.getObjectsFromEOCs(obj, start, boundary)
         self._lineCache[key] = rv
@@ -330,7 +332,7 @@ class LabelInference:
 
         lExtents = self._getExtents(lObj, start, end)
         distance = extents[0] - (lExtents[0] + lExtents[2])
-        if distance <= proximity:
+        if 0 <= distance <= proximity:
             strings = [content[3] or content[0].name for content in onLeft]
             return ''.join(strings)
 



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