[orca] Mouse review: Don't spew giant text blobs at the user
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Mouse review: Don't spew giant text blobs at the user
- Date: Tue, 29 Oct 2019 00:06:42 +0000 (UTC)
commit 364d84dbd2d09da50ea722ef4a6940c591c6bd45
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Oct 28 20:03:45 2019 -0400
Mouse review: Don't spew giant text blobs at the user
Some authors write content with very textful divs whose functional
paragraphs are created by the insertion of br elements. This is why
we cannot have nice things. For the time being, just present the line
under the mouse rather than speak this entire text blob at once.
src/orca/mouse_review.py | 2 ++
src/orca/script_utilities.py | 12 ++++++++++++
2 files changed, 14 insertions(+)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index b6653e813..6b23b8635 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -535,6 +535,8 @@ class MouseReviewer:
boundary = pyatspi.TEXT_BOUNDARY_LINE_START
elif obj and obj.getState().contains(pyatspi.STATE_SELECTABLE):
boundary = pyatspi.TEXT_BOUNDARY_LINE_START
+ elif script.utilities.isMultiParagraphObject(obj):
+ boundary = pyatspi.TEXT_BOUNDARY_LINE_START
new = _ItemContext(pX, pY, obj, boundary, window, script)
if new.present(self._currentMouseOver):
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index fe0d555c4..11b57a03b 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4207,6 +4207,18 @@ class Utilities:
def _adjustPointForObj(self, obj, x, y, coordType):
return x, y
+ def isMultiParagraphObject(self, obj):
+ if not obj:
+ return False
+
+ if "Text" not in pyatspi.listInterfaces(obj):
+ return False
+
+ text = obj.queryText()
+ string = text.getText(0, -1)
+ chunks = list(filter(lambda x: x.strip(), string.split("\n\n")))
+ return len(chunks) > 1
+
def textAtPoint(self, obj, x, y, coordType=None, boundary=None):
text = self.queryNonEmptyText(obj)
if not text:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]