fix ncurses apps

This commit is contained in:
chrys 2016-08-28 17:21:05 +02:00
parent 9ce32b484c
commit 621a6d4aa6
4 changed files with 12 additions and 9 deletions

View File

@ -69,7 +69,7 @@ charEcho=False
# echo deleted chars
charDeleteEcho=True
# echo word after pressing space
wordEcho=True
wordEcho=False
# interrupt speech on any keypress
interruptOnKeyPress=False

View File

@ -10,12 +10,14 @@ class command():
# detect an change on the screen, we just want to cursor arround, so no change should appear
if environment['screenData']['newDelta'] != '':
return environment
if environment['screenData']['newNegativeDelta'] != '':
return environment
# is it a horizontal change?
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
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
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
else:

View File

@ -17,7 +17,7 @@ class command():
return environment
# 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']:
return environment

View File

@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import difflib
import textwrap
import time
import re
@ -10,8 +9,10 @@ import re
class screen():
def __init__(self, device='/dev/vcsa'):
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'):
newTTY = ''
newContentBytes = b''
@ -50,10 +51,10 @@ class screen():
# analyze content
environment['screenData']['newContentText'] = environment['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace")
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']:
self.textWrapper.width = environment['screenData']['columns']
environment['screenData']['oldContentBytes'] = b''
environment['screenData']['oldContentAttrib'] = b''
environment['screenData']['oldContentText'] = ''