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
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):

View File

@ -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('+ '))