From 8e39b7b884c19889d37f7af1b37ac401288d7efd Mon Sep 17 00:00:00 2001 From: Chrys Date: Fri, 6 Sep 2019 22:06:13 +0200 Subject: [PATCH] imporove tab and char echo accuracy --- .../commands/onCursorChange/15000-char_echo.py | 6 ++++++ .../commands/onCursorChange/55000-tab_completion.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py index fbe7eeb6..7ae8aa2d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py @@ -24,6 +24,12 @@ 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 self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]: + return + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + if self.env['runtime']['byteManager'].getLastByteKey() in [b' ', b'\t']: + return # detect deletion or chilling if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: return diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py index 4aeb6d5b..5627c5a3 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py @@ -18,14 +18,14 @@ class command(): def run(self): # try to detect the tab completion by cursor change - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove == 1: + xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] + if xMove > 0: 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' '): + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + if not (self.env['runtime']['byteManager'].getLastByteKey() in [b' ', b'\t']): return # is there any change? if not self.env['runtime']['screenManager'].isDelta():