fix ncurses apps
This commit is contained in:
parent
9ce32b484c
commit
621a6d4aa6
@ -69,7 +69,7 @@ charEcho=False
|
|||||||
# echo deleted chars
|
# echo deleted chars
|
||||||
charDeleteEcho=True
|
charDeleteEcho=True
|
||||||
# echo word after pressing space
|
# echo word after pressing space
|
||||||
wordEcho=True
|
wordEcho=False
|
||||||
# interrupt speech on any keypress
|
# interrupt speech on any keypress
|
||||||
interruptOnKeyPress=False
|
interruptOnKeyPress=False
|
||||||
|
|
||||||
|
@ -10,12 +10,14 @@ class command():
|
|||||||
# detect an change on the screen, we just want to cursor arround, so no change should appear
|
# detect an change on the screen, we just want to cursor arround, so no change should appear
|
||||||
if environment['screenData']['newDelta'] != '':
|
if environment['screenData']['newDelta'] != '':
|
||||||
return environment
|
return environment
|
||||||
|
if environment['screenData']['newNegativeDelta'] != '':
|
||||||
|
return environment
|
||||||
# is it a horizontal change?
|
# is it a horizontal change?
|
||||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
|
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
|
||||||
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']].strip(" \t\n") == '':
|
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].strip() == '':
|
||||||
pass
|
pass
|
||||||
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
|
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
|
||||||
else:
|
else:
|
||||||
|
@ -17,7 +17,7 @@ class command():
|
|||||||
return environment
|
return environment
|
||||||
|
|
||||||
# More than just a deletion happend
|
# More than just a deletion happend
|
||||||
if environment['screenData']['newDelta'].strip(" \t\n") != '':
|
if environment['screenData']['newDelta'].strip() != '':
|
||||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
import textwrap
|
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -10,8 +9,10 @@ import re
|
|||||||
class screen():
|
class screen():
|
||||||
def __init__(self, device='/dev/vcsa'):
|
def __init__(self, device='/dev/vcsa'):
|
||||||
self.vcsaDevicePath = device
|
self.vcsaDevicePath = device
|
||||||
self.textWrapper = textwrap.TextWrapper()
|
|
||||||
self.textWrapper.drop_whitespace = False
|
def insert_newlines(self, string, every=64):
|
||||||
|
return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
|
||||||
|
|
||||||
def analyzeScreen(self, environment, trigger='updateScreen'):
|
def analyzeScreen(self, environment, trigger='updateScreen'):
|
||||||
newTTY = ''
|
newTTY = ''
|
||||||
newContentBytes = b''
|
newContentBytes = b''
|
||||||
@ -50,10 +51,10 @@ class screen():
|
|||||||
# analyze content
|
# analyze content
|
||||||
environment['screenData']['newContentText'] = environment['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace")
|
environment['screenData']['newContentText'] = environment['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "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]
|
||||||
|
environment['screenData']['newContentText'] = self.insert_newlines(environment['screenData']['newContentText'], environment['screenData']['columns'])
|
||||||
|
|
||||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||||
self.textWrapper.width = environment['screenData']['columns']
|
|
||||||
environment['screenData']['oldContentBytes'] = b''
|
environment['screenData']['oldContentBytes'] = b''
|
||||||
environment['screenData']['oldContentAttrib'] = b''
|
environment['screenData']['oldContentAttrib'] = b''
|
||||||
environment['screenData']['oldContentText'] = ''
|
environment['screenData']['oldContentText'] = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user