make highlighted mode work in driver
This commit is contained in:
@@ -24,14 +24,14 @@ def trackHighlights(oldAttr, newAttr, text, lenght):
|
||||
return result, currCursor
|
||||
if len(newAttr) == 0:
|
||||
return result, currCursor
|
||||
textLines = insertNewlines(text,lenght)
|
||||
textLines = textLines.split('\n')
|
||||
if len(oldAttr) != len(newAttr):
|
||||
return result, currCursor
|
||||
old = splitEvery(oldAttr,lenght)
|
||||
new = splitEvery(newAttr,lenght)
|
||||
if len(old) != len(new):
|
||||
return result, currCursor
|
||||
if len(text) != len(new):
|
||||
return result, currCursor
|
||||
new = splitEvery(newAttr,lenght)
|
||||
textLines = text.split('\n')
|
||||
if len(textLines) != len(new):
|
||||
return result, currCursor
|
||||
|
||||
try:
|
||||
background = Counter(newAttr).most_common(1)
|
||||
background = background[0][0]
|
||||
@@ -39,10 +39,11 @@ def trackHighlights(oldAttr, newAttr, text, lenght):
|
||||
background = chr(7)
|
||||
for line in range(len(new)):
|
||||
if old[line] != new[line]:
|
||||
for column in range(len(new)):
|
||||
for column in range(len(new[line])):
|
||||
if old[line][column] != new[line][column]:
|
||||
if new[line][column] != background:
|
||||
if not currCursor:
|
||||
currCursor = {}
|
||||
currCursor['x'] = column
|
||||
currCursor['y'] = line
|
||||
result += textLines[line][column]
|
||||
|
Reference in New Issue
Block a user