add debug

This commit is contained in:
chrys 2018-03-21 21:52:33 +01:00
parent 7535ba7e00
commit 4d265595c6
2 changed files with 11 additions and 7 deletions

View File

@ -26,12 +26,12 @@ class command():
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])
self.env['runtime']['debug'].writeDebugOut('newX:' + str(self.env['screen']['newCursor']['x']) + 'oldX:' + str(self.env['screen']['oldCursor']['x']),debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut('newY:' + str(self.env['screen']['newCursor']['y']) + 'oldY:' + str(self.env['screen']['oldCursor']['y']),debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut('xMove:'+ str(xMove)+' yMove:'+str(yMove),debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut('NewDeltaLen:'+str(len(self.env['screen']['newDelta'])),debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut(str(self.env['screen']),debug.debugLevel.INFO)
#self.env['runtime']['debug'].writeDebugOut('newX:' + str(self.env['screen']['newCursor']['x']) + 'oldX:' + str(self.env['screen']['oldCursor']['x']),debug.debugLevel.INFO)
#self.env['runtime']['debug'].writeDebugOut('newY:' + str(self.env['screen']['newCursor']['y']) + 'oldY:' + str(self.env['screen']['oldCursor']['y']),debug.debugLevel.INFO)
#self.env['runtime']['debug'].writeDebugOut('xMove:'+ str(xMove)+' yMove:'+str(yMove),debug.debugLevel.INFO)
#self.env['runtime']['debug'].writeDebugOut('NewDeltaLen:'+str(len(self.env['screen']['newDelta'])),debug.debugLevel.INFO)
#self.env['runtime']['debug'].writeDebugOut(str(self.env['screen']),debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut('NewDelta:'+str(self.env['screen']['newDelta']),debug.debugLevel.INFO)
if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']):
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
return

View File

@ -340,6 +340,8 @@ class driver(screenDriver):
if oldScreenText == '' and\
newScreenText != '':
self.env['screen']['newDelta'] = newScreenText
self.env['runtime']['debug'].writeDebugOut('VCSA 1',debug.debugLevel.INFO)
else:
cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
cursorLineEnd = cursorLineStart + self.env['screen']['columns']
@ -363,16 +365,18 @@ class driver(screenDriver):
if tempNewDelta.strip() != '':
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']]]
self.env['runtime']['debug'].writeDebugOut('VCSA 2',debug.debugLevel.INFO)
typing = True
else:
diff = difflib.ndiff( oldScreenText.split('\n'),\
newScreenText.split('\n'))
diffList = list(diff)
self.env['runtime']['debug'].writeDebugOut('VCSA 3',debug.debugLevel.INFO)
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] == '+')
self.env['runtime']['debug'].writeDebugOut('VCSA whoops' + str(typing),debug.debugLevel.INFO)
else:
self.env['screen']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+')
self.env['screen']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')