fix autoread

This commit is contained in:
chrys 2016-07-19 23:35:29 +02:00
parent 2df75c6978
commit 6161dae6bb
2 changed files with 8 additions and 3 deletions

View File

@ -5,12 +5,15 @@ class command():
pass pass
def run(self, environment): def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') and\ 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 return environment
ttyChanged = environment['screenData']['newTTY'] != environment['screenData']['oldTTY'] ttyChanged = environment['screenData']['newTTY'] != environment['screenData']['oldTTY']
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \ if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
not ttyChanged: not ttyChanged:
return environment return environment
print(environment['screenData']['newDelta'])
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], ttyChanged) environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], ttyChanged)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -67,9 +67,11 @@ class screen():
environment['screenData']['newDelta'] = environment['screenData']['newContentText'] environment['screenData']['newDelta'] = environment['screenData']['newContentText']
else: else:
diffStart = 0 diffStart = 0
lastLine = len(environment['screenData']['newDelta']) - environment['screenData']['columns'] -1 print(len(environment['screenData']['newContentText']), environment['screenData']['columns'])
if environment['screenData']['newDelta'][:lastLine] == environment['screenData']['oldDelta'][:lastLine]: lastLine = len(environment['screenData']['newContentText']) - environment['screenData']['columns']
if environment['screenData']['newContentText'][:lastLine] == environment['screenData']['oldContentText'][:lastLine]:
diffStart = lastLine + 1 diffStart = lastLine + 1
diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'][diffStart:].split(' ')),\ diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'][diffStart:].split(' ')),\
" ".join(environment['screenData']['newContentText'][diffStart:].split(' '))) " ".join(environment['screenData']['newContentText'][diffStart:].split(' ')))
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ ')) environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))