fix offset

This commit is contained in:
chrys 2017-09-20 00:14:13 +02:00
parent f50c273a39
commit 4b175356ff

View File

@ -337,16 +337,16 @@ class driver():
self.env['screen']['newDelta'] = newScreenText self.env['screen']['newDelta'] = newScreenText
else: else:
cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y'] cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
cursorLineEnd = cursorLineStart + self.env['screen']['columns'] cursorLineEnd = cursorLineStart + self.env['screen']['columns']
if self.env['screen']['oldCursor']['x'] != self.env['screen']['newCursor']['x'] and \ if self.env['screen']['oldCursor']['x'] != self.env['screen']['newCursor']['x'] and \
self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \
self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart]: self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart]:
cursorLineStartOffset = cursorLineStart cursorLineStartOffset = cursorLineStart
cursorLineEndOffset = cursorLineEnd cursorLineEndOffset = cursorLineEnd
if (cursorLineStart - 4) > self.env['screen']['newCursor']['y'] * self.env['screen']['columns']: if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4:
cursorLineStartOffset = (self.env['screen']['newCursor']['x'] - 4) cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4
if (cursorLineEndOffset + 4) < self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['columns']: if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 4:
cursorLineEndOffset = (self.env['screen']['newCursor']['x'] + 4) cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 4
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset] oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
oldScreenText = re.sub(' +',' ',oldScreenText) oldScreenText = re.sub(' +',' ',oldScreenText)
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]