make typing echo more useful

This commit is contained in:
chrys 2016-07-17 14:01:55 +02:00
parent 027be8a80b
commit 659e99d810
2 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,8 @@ class command():
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']: environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
return environment return environment
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].replace(" ","").replace("\n","").replace("\t","") == '': if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].replace(" ","").replace("\n","").replace("\t","") == '':
environment['runtime']['outputManager'].presentText(environment, "blank",True) pass
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
else: else:
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']],True) environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']],True)

View File

@ -48,10 +48,10 @@ class screen():
environment['screenData']['newCursor']['x'] = int( environment['screenData']['newContentBytes'][2]) environment['screenData']['newCursor']['x'] = int( environment['screenData']['newContentBytes'][2])
environment['screenData']['newCursor']['y'] = int( environment['screenData']['newContentBytes'][3]) environment['screenData']['newCursor']['y'] = int( environment['screenData']['newContentBytes'][3])
# analyze content # analyze content
environment['screenData']['newContentText'] = str(environment['screenData']['newContentBytes'][4:][::2].decode("ascii", "replace")) environment['screenData']['newContentText'] = str(environment['screenData']['newContentBytes'][4:][::2].decode("CP1252", "replace"))
environment['screenData']['newContentAttrib'] = environment['screenData']['newContentBytes'][5:][::2] environment['screenData']['newContentAttrib'] = environment['screenData']['newContentBytes'][5:][::2]
environment['screenData']['newContentText'] = '\n'.join(self.textWrapper.wrap(environment['screenData']['newContentText'], ))[:-2] environment['screenData']['newContentText'] = '\n'.join(self.textWrapper.wrap(environment['screenData']['newContentText'], ))[:-2]
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
self.textWrapper.width = environment['screenData']['columns'] self.textWrapper.width = environment['screenData']['columns']
environment['screenData']['oldContentBytes'] = b'' environment['screenData']['oldContentBytes'] = b''
@ -68,4 +68,5 @@ class screen():
diff = difflib.ndiff(" ".join(environment['screenData']['oldContentText'].split()), " ".join(environment['screenData']['newContentText'].split())) 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('+ ')) environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
return environment return environment