diff --git a/src/fenrir/commands/onCursorChange/45000-present_char_if_cursor_change_horizontal.py b/src/fenrir/commands/onCursorChange/45000-present_char_if_cursor_change_horizontal.py deleted file mode 100644 index 7128b903..00000000 --- a/src/fenrir/commands/onCursorChange/45000-present_char_if_cursor_change_horizontal.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # detect an change on the screen, we just want to cursor arround, so no change should appear - if self.env['runtime']['screenManager'].isDelta(): - return - if self.env['runtime']['screenManager'].isNegativeDelta(): - return - # is a vertical change? - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # is it a horizontal change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if not currChar.isspace(): - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/50000-char_echo.py b/src/fenrir/commands/onCursorChange/50000-char_echo.py deleted file mode 100644 index 832263b2..00000000 --- a/src/fenrir/commands/onCursorChange/50000-char_echo.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - # 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['screen']['newDelta']) > 3: - return - # filter unneded space on word begin - currDelta = self.env['screen']['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, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index 618a89aa..73f41eb9 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -165,7 +165,7 @@ class driver(): screenContent = dirtyContent if time.time() - timeout >= 0.4: break - time.sleep(0.03) + time.sleep(0.005) vcsa[currScreen].seek(0) dirtyContent = vcsa[currScreen].read() eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None}) @@ -341,13 +341,18 @@ class driver(): if self.env['screen']['oldCursor']['x'] != self.env['screen']['newCursor']['x'] and \ self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart]: - - oldScreenText = self.env['screen']['oldContentText'][cursorLineStart:cursorLineEnd] + cursorLineStartOffset = cursorLineStart + cursorLineEndOffset = cursorLineEnd + if (cursorLineStart - 4) > self.env['screen']['newCursor']['y'] * self.env['screen']['columns']: + cursorLineStartOffset = (self.env['screen']['newCursor']['x'] - 4) + if (cursorLineEndOffset + 4) < self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['columns']: + cursorLineEndOffset = (self.env['screen']['newCursor']['x'] + 4) + oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset] oldScreenText = re.sub(' +',' ',oldScreenText) - newScreenText = self.env['screen']['newContentText'][cursorLineStart:cursorLineEnd] + newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] newScreenText = re.sub(' +',' ',newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText) - typing = True + typing = True else: diff = difflib.ndiff( oldScreenText.split('\n'),\ newScreenText.split('\n'))