[orca] Be sure we have an adjusted terminal-inserted string before replacement
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Be sure we have an adjusted terminal-inserted string before replacement
- Date: Wed, 24 Aug 2016 17:05:20 +0000 (UTC)
commit 0764fa62ee42a014b7b7abd0e551ae3f24e8b0e1
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Aug 24 13:03:46 2016 -0400
Be sure we have an adjusted terminal-inserted string before replacement
src/orca/scripts/terminal/script.py | 5 -----
src/orca/scripts/terminal/script_utilities.py | 15 ++++++++++++++-
2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/scripts/terminal/script.py b/src/orca/scripts/terminal/script.py
index 3bf1989..2e8bd7c 100644
--- a/src/orca/scripts/terminal/script.py
+++ b/src/orca/scripts/terminal/script.py
@@ -98,12 +98,7 @@ class Script(default.Script):
msg = "TERMINAL: Insertion is believed to be due to terminal command"
debug.println(debug.LEVEL_INFO, msg, True)
- oldString = event.any_data
newString = self.utilities.insertedText(event)
- if oldString != newString:
- msg = "TERMINAL: Adjusting event string to: %s" % newString
- debug.println(debug.LEVEL_INFO, msg, True)
-
if len(newString) == 1:
self.speakCharacter(newString)
else:
diff --git a/src/orca/scripts/terminal/script_utilities.py b/src/orca/scripts/terminal/script_utilities.py
index ce37d85..0d153b3 100644
--- a/src/orca/scripts/terminal/script_utilities.py
+++ b/src/orca/scripts/terminal/script_utilities.py
@@ -64,14 +64,27 @@ class Utilities(script_utilities.Utilities):
boundary = pyatspi.TEXT_BOUNDARY_LINE_START
firstLine = text.getTextAtOffset(start, boundary)
+ msg = "TERMINAL: First line of insertion: '%s' (%i, %i)" % firstLine
+ debug.println(debug.LEVEL_INFO, msg, True)
if firstLine != ("", 0, 0):
start = firstLine[1]
lastLine = text.getTextAtOffset(end - 1, boundary)
+ msg = "TERMINAL: Last line of insertion: '%s' (%i, %i)" % lastLine
+ debug.println(debug.LEVEL_INFO, msg, True)
if lastLine != ("", 0, 0):
end = min(lastLine[2], text.caretOffset)
- return text.getText(start, end)
+ adjusted = text.getText(start, end)
+ if adjusted:
+ msg = "TERMINAL: Adjusted insertion: '%s'" % adjusted
+ debug.println(debug.LEVEL_INFO, msg, True)
+ else:
+ msg = "TERMINAL: Adjustment failed. Returning any_data."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ adjusted = event.any_data
+
+ return adjusted
def isEditableTextArea(self, obj):
if obj and obj.getRole() == pyatspi.ROLE_TERMINAL:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]