From fe96d204a73c17cead6bf7b615aa875b1cc34235 Mon Sep 17 00:00:00 2001 From: Chrys Date: Fri, 6 Sep 2019 18:16:13 +0200 Subject: [PATCH] try to harden tab completion --- .../commands/onCursorChange/55000-tab_completion.py | 10 ++++++++-- .../commands/onScreenUpdate/70000-incoming.py | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py index 0407ac9b..4aeb6d5b 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py @@ -21,11 +21,17 @@ class command(): xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) if xMove == 1: return + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]): + return + if self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + if not (self.env['runtime']['byteManager'].getLastByteKey() in [b' '): + return # is there any change? if not self.env['runtime']['screenManager'].isDelta(): - return + return if not xMove == len(self.env['screen']['newDelta']): - return + return # detect deletion or chilling if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: return diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py index cc2bc393..3d1595a2 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py @@ -14,7 +14,7 @@ class command(): def shutdown(self): pass def getDescription(self): - return 'No Description found' + return 'No Description found' def run(self): if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): @@ -31,7 +31,7 @@ class command(): if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: if not '\n' in self.env['screen']['newDelta']: - return + return #print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta'])) self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)