From 4a7a36e6b8a44075a487f3f383bb0bc3ce47dd8d Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 23 Dec 2016 00:16:34 +0100 Subject: [PATCH] some more tweaks --- config/settings/settings.conf | 2 +- src/fenrir/commands/onInput/50000-char_echo.py | 7 ++++++- src/fenrir/commands/onInput/60000-word_echo.py | 15 +++++++-------- src/fenrir/commands/onInput/62000-spell_check.py | 8 +++++--- .../commands/onInput/65000-char_delete_echo.py | 7 +++++-- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 019fff66..94d86658 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -90,7 +90,7 @@ charEcho=False # echo deleted chars charDeleteEcho=True # echo word after pressing space -wordEcho=False +wordEcho=True # interrupt speech on any keypress interruptOnKeyPress=False # you can filter the keys on that the speech should interrupt (empty = all keys, otherwhise the given keys) diff --git a/src/fenrir/commands/onInput/50000-char_echo.py b/src/fenrir/commands/onInput/50000-char_echo.py index 031f65c1..3e282650 100644 --- a/src/fenrir/commands/onInput/50000-char_echo.py +++ b/src/fenrir/commands/onInput/50000-char_echo.py @@ -28,7 +28,12 @@ class command(): # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) if len(self.env['screenData']['newDelta']) > 3: return - self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) + # filter unneded space on word begin + currDelta = self.env['screenData']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/onInput/60000-word_echo.py b/src/fenrir/commands/onInput/60000-word_echo.py index 2ed2721a..bb03357c 100644 --- a/src/fenrir/commands/onInput/60000-word_echo.py +++ b/src/fenrir/commands/onInput/60000-word_echo.py @@ -38,16 +38,15 @@ class command(): newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] x, y, currWord, endOfScreen, lineBreak = \ word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) - # was this a typed word? + # currently writing if self.env['runtime']['screenManager'].isDelta(): - # is there a delta bigger than keyecho? - if len(self.env['screenData']['newDelta']) > 1: - return - if not(newContent[self.env['screenData']['oldCursor']['x']].isspace() and x != self.env['screenData']['oldCursor']['x']): - return + return else: - # or just arrow arround? - if not(newContent[self.env['screenData']['newCursor']['x']].isspace() and x != self.env['screenData']['newCursor']['x']): + # at the end of a word + if not newContent[self.env['screenData']['newCursor']['x']].isspace(): + return + if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screenData']['newCursor']['x']-1): return if currWord != '': diff --git a/src/fenrir/commands/onInput/62000-spell_check.py b/src/fenrir/commands/onInput/62000-spell_check.py index cc503e29..b333ef91 100644 --- a/src/fenrir/commands/onInput/62000-spell_check.py +++ b/src/fenrir/commands/onInput/62000-spell_check.py @@ -72,9 +72,11 @@ class command(): currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~') else: # or just arrow arround? - if not(newContent[self.env['screenData']['newCursor']['x']].isspace() and x != self.env['screenData']['newCursor']['x']): - return - + if not newContent[self.env['screenData']['newCursor']['x']].isspace(): + return + if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screenData']['newCursor']['x']-1): + return # ignore empty if currWord.strip(string.whitespace) =='': return diff --git a/src/fenrir/commands/onInput/65000-char_delete_echo.py b/src/fenrir/commands/onInput/65000-char_delete_echo.py index 89c11079..ead8360e 100644 --- a/src/fenrir/commands/onInput/65000-char_delete_echo.py +++ b/src/fenrir/commands/onInput/65000-char_delete_echo.py @@ -38,8 +38,11 @@ class command(): # word begin produce a diff wiht len == 2 |a | others with 1 |a| if len(self.env['screenData']['newNegativeDelta']) > 2: return - - self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) + currNegativeDelta = self.env['screenData']['newNegativeDelta'] + if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ + currNegativeDelta.strip() != '': + currNegativeDelta = currNegativeDelta.strip() + self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass