improve speed if tty changes
This commit is contained in:
parent
ec3d6e22a8
commit
cd39f2ee29
@ -57,14 +57,17 @@ class screen():
|
|||||||
environment['screenData']['oldCursor']['y'] = 0
|
environment['screenData']['oldCursor']['y'] = 0
|
||||||
environment['screenData']['oldDelta'] = ''
|
environment['screenData']['oldDelta'] = ''
|
||||||
environment['screenData']['newDelta'] = ''
|
environment['screenData']['newDelta'] = ''
|
||||||
|
|
||||||
# changes on the screen
|
# changes on the screen
|
||||||
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
|
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
|
||||||
(len(environment['screenData']['newContentText']) > 0):
|
(len(environment['screenData']['newContentText']) > 0):
|
||||||
# diff = difflib.ndiff(environment['screenData']['oldContentText'], environment['screenData']['newContentText'])
|
# diff = difflib.ndiff(environment['screenData']['oldContentText'], environment['screenData']['newContentText'])
|
||||||
|
if environment['screenData']['oldContentText'] == '' and\
|
||||||
diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'].split(' ')), " ".join(environment['screenData']['newContentText'].split(' ')))
|
environment['screenData']['newContentText'] != '':
|
||||||
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
|
environment['screenData']['newDelta'] = environment['screenData']['newContentText']
|
||||||
|
else:
|
||||||
|
diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'].split(' ')), " ".join(environment['screenData']['newContentText'].split(' ')))
|
||||||
|
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
|
||||||
|
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
|
Loading…
Reference in New Issue
Block a user