[orca/gnome-3-22] Reduce some chattiness using vim
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-22] Reduce some chattiness using vim
- Date: Mon, 10 Oct 2016 23:19:59 +0000 (UTC)
commit c985bc5686a3a66237094199312f1fe3ef54d50c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Oct 10 19:13:48 2016 -0400
Reduce some chattiness using vim
src/orca/script_utilities.py | 3 +
src/orca/scripts/default.py | 2 +-
src/orca/scripts/terminal/script_utilities.py | 20 ++++-
test/keystrokes/gnome-terminal/vim-append.py | 99 +++++++++++++++++++++++++
4 files changed, 120 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 61d6185..6112c37 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2396,6 +2396,9 @@ class Utilities:
return None
+ def deletedText(self, event):
+ return event.any_data
+
def insertedText(self, event):
if event.any_data:
return event.any_data
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 6d5f4cc..1cde650 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2517,7 +2517,7 @@ class Script(script.Script):
self.utilities.updateCachedTextSelection(event.source)
return
- string = event.any_data
+ string = self.utilities.deletedText(event)
if self.utilities.isDeleteCommandTextDeletionEvent(event):
msg = "DEFAULT: Deletion is believed to be due to Delete command"
debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/terminal/script_utilities.py b/src/orca/scripts/terminal/script_utilities.py
index 0c0448a..ae36bdd 100644
--- a/src/orca/scripts/terminal/script_utilities.py
+++ b/src/orca/scripts/terminal/script_utilities.py
@@ -25,6 +25,7 @@ __copyright__ = "Copyright (c) 2016 Igalia, S.L."
__license__ = "LGPL"
import pyatspi
+import re
from orca import debug
from orca import keybindings
@@ -43,6 +44,16 @@ class Utilities(script_utilities.Utilities):
def clearCache(self):
pass
+ def deletedText(self, event):
+ match = re.search("\n~", event.any_data)
+ if not match:
+ return event.any_data
+
+ adjusted = event.any_data[:match.start()]
+ msg = "TERMINAL: Adjusted deletion: '%s'" % adjusted
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return adjusted
+
def insertedText(self, event):
if len(event.any_data) == 1:
return event.any_data
@@ -127,8 +138,8 @@ class Utilities(script_utilities.Utilities):
lastKey, mods = self.lastKeyAndModifiers()
if lastKey == "Tab":
return event.any_data != "\t"
- if lastKey == "Return":
- return event.any_data.startswith("\n")
+ if lastKey == "Return" and event.any_data.startswith("\n"):
+ return event.any_data.strip() and not event.any_data.count("\n~")
return False
@@ -163,9 +174,12 @@ class Utilities(script_utilities.Utilities):
if self.lastInputEventWasPaste():
return False
+ if event.any_data.count("\n~"):
+ return False
+
keyString, mods = self.lastKeyAndModifiers()
if keyString in ["Return", "Tab", "space", " "]:
- return True
+ return re.search("[^\d\s]", event.any_data)
if mods & keybindings.ALT_MODIFIER_MASK:
return True
if len(event.any_data) > 1 and self.lastInputEventWasPrintableKey():
diff --git a/test/keystrokes/gnome-terminal/vim-append.py b/test/keystrokes/gnome-terminal/vim-append.py
new file mode 100644
index 0000000..2c6e738
--- /dev/null
+++ b/test/keystrokes/gnome-terminal/vim-append.py
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(PauseAction(3000))
+sequence.append(TypeAction("vim"))
+sequence.append(KeyComboAction("Return"))
+sequence.append(PauseAction(3000))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("a"))
+sequence.append(utils.AssertPresentationAction(
+ "1. A to append text",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame '",
+ " VISIBLE: '', cursor=1",
+ "SPEECH OUTPUT: '-- INSERT -- 0,1 '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(TypeAction("Hi Hi"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Type 'Hi Hi'",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame H'",
+ " VISIBLE: 'H', cursor=2",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame H'",
+ " VISIBLE: 'H', cursor=2",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi'",
+ " VISIBLE: 'Hi', cursor=3",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi'",
+ " VISIBLE: 'Hi', cursor=3",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi'",
+ " VISIBLE: 'Hi', cursor=3",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi H'",
+ " VISIBLE: 'Hi H', cursor=5",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi H'",
+ " VISIBLE: 'Hi H', cursor=5",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi Hi'",
+ " VISIBLE: 'Hi Hi', cursor=6",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi Hi'",
+ " VISIBLE: 'Hi Hi', cursor=6"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("BackSpace"))
+sequence.append(utils.AssertPresentationAction(
+ "3. BackSpace",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi H'",
+ " VISIBLE: 'Hi H', cursor=5",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi H'",
+ " VISIBLE: 'Hi H', cursor=5",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi H'",
+ " VISIBLE: 'Hi H', cursor=5",
+ "SPEECH OUTPUT: 'i'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("BackSpace"))
+sequence.append(utils.AssertPresentationAction(
+ "4. BackSpace",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=4",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=4",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=4",
+ "SPEECH OUTPUT: 'H'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("BackSpace"))
+sequence.append(utils.AssertPresentationAction(
+ "5. BackSpace",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=3",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=3",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi '",
+ " VISIBLE: 'Hi ', cursor=3",
+ "SPEECH OUTPUT: '4'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(TypeAction("!"))
+sequence.append(utils.AssertPresentationAction(
+ "6. Type '!'",
+ ["BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi!'",
+ " VISIBLE: 'Hi!', cursor=4",
+ "BRAILLE LINE: 'gnome-terminal-server application jd@blockhead:/tmp/gnome-terminal-wd frame Hi!'",
+ " VISIBLE: 'Hi!', cursor=4"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.AssertPresentationAction(
+ "7. Return",
+ ["BRAILLE LINE: ''",
+ " VISIBLE: '', cursor=1",
+ "BRAILLE LINE: ''",
+ " VISIBLE: '', cursor=1"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]