fix last linebreak

This commit is contained in:
chrys 2016-07-07 01:12:26 +02:00
parent cfc1dfb1ca
commit 72052566d0

View File

@ -52,7 +52,7 @@ while(runtime['running']):
# analyze content # analyze content
runtime['newContentText'] = str(runtime['newContentBytes'][4:][::2].decode('cp1252').encode('utf-8')) runtime['newContentText'] = str(runtime['newContentBytes'][4:][::2].decode('cp1252').encode('utf-8'))
runtime['newContentAttrib'] = runtime['newContentBytes'][5:][::2] runtime['newContentAttrib'] = runtime['newContentBytes'][5:][::2]
runtime['newContentText'] = '\n'.join(textwrap.wrap(runtime['newContentText'], runtime['columns'])) runtime['newContentText'] = '\n'.join(textwrap.wrap(runtime['newContentText'], runtime['columns']))[:-1]
if runtime['newTTY'] != runtime['oldTTY']: if runtime['newTTY'] != runtime['oldTTY']:
runtime['oldContentBytes'] = b'' runtime['oldContentBytes'] = b''
runtime['oldContentAttrib'] = b'' runtime['oldContentAttrib'] = b''
@ -69,7 +69,7 @@ while(runtime['running']):
print(runtime['delta']) print(runtime['delta'])
diff = difflib.ndiff(runtime['oldContentText'], runtime['newContentText']) diff = difflib.ndiff(runtime['oldContentText'], runtime['newContentText'])
runtime['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ ')) runtime['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
print(runtime['delta'])
runtime['speechDriver'].speak(runtime['delta']) runtime['speechDriver'].speak(runtime['delta'])
# set new "old" values # set new "old" values