Revert "try to improve the differ"

This reverts commit db7bc95d1a.

Reverted changes.
This commit is contained in:
Storm Dragon 2016-10-23 20:01:18 -04:00
parent 5a46b3320e
commit 4ed32299f9

View File

@ -118,19 +118,19 @@ class driver():
typing = False typing = False
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \ if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \
(self.env['screenData']['newContentText'] != '' ): (self.env['screenData']['newContentText'] != '' ):
if self.env['screenData']['oldContentText'] == '' and\ if oldScreenText == '' and\
newScreenText != '': newScreenText != '':
self.env['screenData']['newDelta'] = newScreenText self.env['screenData']['newDelta'] = newScreenText
else: else:
cursorLineStart = self.env['screenData']['lines'] * self.env['screenData']['columns'] + self.env['screenData']['lines'] cursorLineStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y']
cursorLineEnd = cursorLineStart + self.env['screenData']['columns'] cursorLineEnd = cursorLineStart + self.env['screenData']['columns']
if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \ if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \
self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \ self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \
self.env['screenData']['newContentText'][:cursorLineStart] == self.env['screenData']['oldContentText'][:cursorLineStart] and \ self.env['screenData']['newContentText'][:cursorLineStart] == self.env['screenData']['oldContentText'][:cursorLineStart]:
self.env['screenData']['newContentText'][cursorLineEnd:] == self.env['screenData']['oldContentText'][cursorLineEnd:]:
oldScreenText = self.env['screenData']['oldContentText'][cursorLineStart:cursorLineEnd + 1] oldScreenText = self.env['screenData']['oldContentText'][cursorLineStart:cursorLineEnd]
oldScreenText = re.sub(' +',' ',oldScreenText) oldScreenText = re.sub(' +',' ',oldScreenText)
newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd + 1] newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd]
newScreenText = re.sub(' +',' ',newScreenText) newScreenText = re.sub(' +',' ',newScreenText)
diff = difflib.ndiff(oldScreenText, newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText)
typing = True typing = True