remove re.sub

This commit is contained in:
chrys 2017-11-10 20:08:58 +01:00
parent 553f5dc456
commit 09a07ab11e
3 changed files with 11 additions and 6 deletions

View File

@ -24,8 +24,9 @@ class command():
return
# More than just a deletion happend
if self.env['runtime']['screenManager'].isDelta():
if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True):
return
# no deletion
if not self.env['runtime']['screenManager'].isNegativeDelta():
return
@ -33,7 +34,8 @@ class command():
# too much for a single backspace...
# word begin produce a diff wiht len == 2 |a | others with 1 |a|
if len(self.env['screen']['newNegativeDelta']) > 2:
return
return
currNegativeDelta = self.env['screen']['newNegativeDelta']
if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \
currNegativeDelta.strip() != '':

View File

@ -66,8 +66,11 @@ class screenManager():
if not self.env['screen']['oldTTY']:
return False
return self.env['screen']['newTTY'] != self.env['screen']['oldTTY']
def isDelta(self):
return self.env['screen']['newDelta'] != ''
def isDelta(self, ignoreSpace=False):
newDelta = self.env['screen']['newDelta']
if ignoreSpace:
newDelta = newDelta.strip()
return newDelta != ''
def isNegativeDelta(self):
return self.env['screen']['newNegativeDelta'] != ''
def getWindowAreaInText(self, text):

View File

@ -348,9 +348,9 @@ class driver(screenDriver):
if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3:
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
oldScreenText = re.sub(' +',' ',oldScreenText)
# oldScreenText = re.sub(' +',' ',oldScreenText)
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
newScreenText = re.sub(' +',' ',newScreenText)
#newScreenText = re.sub(' +',' ',newScreenText)
diff = difflib.ndiff(oldScreenText, newScreenText)
typing = True
else: