cleanup indention speak

This commit is contained in:
chrys 2018-03-24 21:29:54 +01:00
parent 67551a83f8
commit 59203ab838
3 changed files with 16 additions and 13 deletions

View File

@ -42,13 +42,9 @@ class command():
self.lastIdent = currIdent
doInterrupt = True
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'):
if self.lastIdent < currIdent:
self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent - self.lastIdent) + ' ', interrupt=doInterrupt, flush=False)
if self.lastIdent != currIdent:
self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False)
doInterrupt = False
elif self.lastIdent > currIdent:
self.env['runtime']['outputManager'].presentText(_('outdented ') + str(self.lastIdent - currIdent) + ' ', interrupt=doInterrupt, flush=False)
doInterrupt = False
self.env['runtime']['outputManager'].presentText(currLine, interrupt=doInterrupt, flush=False)
self.lastIdent = currIdent
def setCallback(self, callback):

View File

@ -86,6 +86,7 @@ class screenManager():
if oldScreenText == '' and\
newScreenText != '':
self.env['screen']['newDelta'] = newScreenText
print(1)
else:
cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
cursorLineEnd = cursorLineStart + self.env['screen']['columns']
@ -110,10 +111,12 @@ class screenManager():
if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()):
diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]]
typing = True
print(2)
else:
diff = difflib.ndiff( oldScreenText.split('\n'),\
newScreenText.split('\n'))
diffList = list(diff)
print(3)
if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing:
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')

View File

@ -41,7 +41,12 @@ class Terminal:
for char in (line[x] for x in range(self.screen.columns))]
allAttributes.append((attributes))
self.screen.dirty.clear()
return {"cursor": (cursor.x, cursor.y), "lines": text, 'attributes': allAttributes}.copy()
return {"cursor": (cursor.x, cursor.y),
'lines': self.screen.lines,
'columns': self.screen.columns,
"text": text,
'attributes': allAttributes
}.copy()
class driver(screenDriver):
def __init__(self):
@ -54,8 +59,8 @@ class driver(screenDriver):
self.env = environment
self.env['runtime']['processManager'].addCustomEventThread(self.terminalEmulation)
def getCurrScreen(self):
self.env['screen']['oldTTY'] = str(1)
self.env['screen']['newTTY'] = str(1)
self.env['screen']['oldTTY'] = '1'
self.env['screen']['newTTY'] = '1'
def injectTextToScreen(self, text, screen = None):
pass
@ -164,16 +169,15 @@ class driver(screenDriver):
def createScreenEventData(self, content):
eventData = {
'bytes': content,
'lines': int( 37),
'columns': int( 138
),
'lines': content['lines'],
'columns': content['columns'],
'textCursor':
{
'x': int( content['cursor'][0]),
'y': int( content['cursor'][1])
},
'screen': '1',
'text': content['lines'],
'text': content['text'],
'attributes': content['attributes'],
'screenUpdateTime': time.time(),
}