[orca/gnome-3-34] Improve presentation of selection of links which span multiple lines
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-34] Improve presentation of selection of links which span multiple lines
- Date: Tue, 24 Sep 2019 14:21:33 +0000 (UTC)
commit c26b1142f2a2a0973abe56a89cdb6978d7cea734
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Sep 24 16:19:58 2019 +0200
Improve presentation of selection of links which span multiple lines
src/orca/script_utilities.py | 16 +++++++++++++---
src/orca/scripts/web/script_utilities.py | 6 +++---
2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 73d71c606..50161b907 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -5253,7 +5253,7 @@ class Utilities:
return False
- def handleTextSelectionChange(self, obj):
+ def handleTextSelectionChange(self, obj, speakMessage=True):
# Note: This guesswork to figure out what actually changed with respect
# to text selection will get eliminated once the new text-selection API
# is added to ATK and implemented by the toolkits. (BGO 638378)
@@ -5290,10 +5290,20 @@ class Utilities:
changeStart, changeEnd = change[0], change[-1] + 1
if oldChars < newChars:
changes.append([changeStart, changeEnd, messages.TEXT_SELECTED])
+ if oldString.endswith(self.EMBEDDED_OBJECT_CHARACTER) and oldEnd == changeStart:
+ # There's a possibility that we have a link spanning multiple lines. If so,
+ # we want to present the continuation that just became selected.
+ child = self.getChildAtOffset(obj, oldEnd - 1)
+ self.handleTextSelectionChange(child, False)
else:
changes.append([changeStart, changeEnd, messages.TEXT_UNSELECTED])
+ if newString.endswith(self.EMBEDDED_OBJECT_CHARACTER):
+ # There's a possibility that we have a link spanning multiple lines. If so,
+ # we want to present the continuation that just became unselected.
+ child = self.getChildAtOffset(obj, newEnd - 1)
+ self.handleTextSelectionChange(child, False)
- speakMessage = not _settingsManager.getSetting('onlySpeakDisplayedText')
+ speakMessage = speakMessage and not _settingsManager.getSetting('onlySpeakDisplayedText')
text = obj.queryText()
for start, end, message in changes:
string = text.getText(start, end)
@@ -5307,7 +5317,7 @@ class Utilities:
if endsWithChild:
child = self.getChildAtOffset(obj, end)
- self.handleTextSelectionChange(child)
+ self.handleTextSelectionChange(child, speakMessage)
return True
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 5306c69de..e265c4e5c 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1773,11 +1773,11 @@ class Utilities(script_utilities.Utilities):
if self.hasPresentableText(obj):
super().updateCachedTextSelection(obj)
- def handleTextSelectionChange(self, obj):
+ def handleTextSelectionChange(self, obj, speakMessage=True):
if not self.inDocumentContent(obj):
return super().handleTextSelectionChange(obj)
- if self.hasPresentableText(obj) and super().handleTextSelectionChange(obj):
+ if self.hasPresentableText(obj) and super().handleTextSelectionChange(obj, speakMessage):
return True
handled = False
@@ -1786,7 +1786,7 @@ class Utilities(script_utilities.Utilities):
if handled:
super().updateCachedTextSelection(descendant)
else:
- handled = handled or super().handleTextSelectionChange(descendant)
+ handled = super().handleTextSelectionChange(descendant, speakMessage)
return handled
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]