From 6161dae6bbfca3f42453b8e5d8cfa776eb6675f0 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 19 Jul 2016 23:35:29 +0200 Subject: [PATCH] fix autoread --- .../commands/onScreenChanged/70000-speak_incomming.py | 5 ++++- src/fenrir-package/screen/linux.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py b/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py index 78d5bf5a..aff8d852 100644 --- a/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py +++ b/src/fenrir-package/commands/onScreenChanged/70000-speak_incomming.py @@ -5,12 +5,15 @@ class command(): pass def run(self, environment): if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') and\ - environment['screenData']['newCursor'] - environment['screenData']['oldCursor'] ==1: + environment['screenData']['newCursor']['x'] - environment['screenData']['oldCursor']['x'] ==1: return environment + ttyChanged = environment['screenData']['newTTY'] != environment['screenData']['oldTTY'] if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \ not ttyChanged: return environment + print(environment['screenData']['newDelta']) + environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], ttyChanged) return environment def setCallback(self, callback): diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index 0aac8e29..6e7eb599 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -67,9 +67,11 @@ class screen(): environment['screenData']['newDelta'] = environment['screenData']['newContentText'] else: diffStart = 0 - lastLine = len(environment['screenData']['newDelta']) - environment['screenData']['columns'] -1 - if environment['screenData']['newDelta'][:lastLine] == environment['screenData']['oldDelta'][:lastLine]: + print(len(environment['screenData']['newContentText']), environment['screenData']['columns']) + lastLine = len(environment['screenData']['newContentText']) - environment['screenData']['columns'] + if environment['screenData']['newContentText'][:lastLine] == environment['screenData']['oldContentText'][:lastLine]: diffStart = lastLine + 1 + diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'][diffStart:].split(' ')),\ " ".join(environment['screenData']['newContentText'][diffStart:].split(' '))) environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))