[orca] Attempt to filter out terminal pager text-change noise
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Attempt to filter out terminal pager text-change noise
- Date: Mon, 22 Aug 2016 19:20:11 +0000 (UTC)
commit 5afb51e5c87115fc3b2e13a4ea7de5611b24f483
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Aug 22 15:18:04 2016 -0400
Attempt to filter out terminal pager text-change noise
We're not interested in pager deletion events, so processing these
further and updating braille in response is a waste of time.
src/orca/script_utilities.py | 25 +++++++++++++++++++++++++
src/orca/scripts/default.py | 5 +++++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index f811ef4..389f0ca 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4126,6 +4126,31 @@ class Utilities:
return False
+ def treatEventAsTerminalNoise(self, event):
+ try:
+ role = event.source.getRole()
+ except:
+ msg = "ERROR: Exception getting role of %s" % event.source
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
+ if role != pyatspi.ROLE_TERMINAL:
+ return False
+
+ if self.lastInputEventWasCommand():
+ return False
+
+ if event.type.startswith("object:text-changed:delete") and event.any_data.strip():
+ keyString, mods = self.lastKeyAndModifiers()
+ if keyString in ["Return", "Tab", "space", " "]:
+ return True
+ if mods & keybindings.ALT_MODIFIER_MASK:
+ return True
+ if len(event.any_data) > 1 and self.lastInputEventWasPrintableKey():
+ return True
+
+ return False
+
def isPresentableTextChangedEventForLocusOfFocus(self, event):
if not event.type.startswith("object:text-changed:") \
and not event.type.startswith("object:text-attributes-changed"):
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index f111a4d..2c34ecf 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2507,6 +2507,11 @@ class Script(script.Script):
if not self.utilities.isPresentableTextChangedEventForLocusOfFocus(event):
return
+ if self.utilities.treatEventAsTerminalNoise(event):
+ msg = "DEFAULT: Deletion is believed to be noise"
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return
+
self.utilities.handleUndoTextEvent(event)
orca.setLocusOfFocus(event, event.source, False)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]