@@ -933,10 +933,12 @@ def tokenize(self, s, newline=False):
933
933
- reads self.cpos to see what parens should be highlighted
934
934
- reads self.buffer to see what came before the passed in line
935
935
- sets self.highlighted_paren to (buffer_lineno, tokens_for_that_line)
936
- for buffer line that should replace that line to unhighlight it
936
+ for buffer line that should replace that line to unhighlight it,
937
+ or None if no paren is currently highlighted
937
938
- calls reprint_line with a buffer's line's tokens and the buffer
938
- lineno that has changed iff that line is the not the current line
939
+ lineno that has changed if line other than the current line changes
939
940
"""
941
+ highlighted_paren = None
940
942
941
943
source = '\n ' .join (self .buffer + [s ])
942
944
cursor = len (source ) - self .cpos
@@ -1007,16 +1009,17 @@ def tokenize(self, s, newline=False):
1007
1009
line_tokens [- 1 ] = (Parenthesis , value )
1008
1010
(lineno , i , tokens , opening ) = opening
1009
1011
if lineno == len (self .buffer ):
1010
- self . highlighted_paren = (lineno , saved_tokens )
1012
+ highlighted_paren = (lineno , saved_tokens )
1011
1013
line_tokens [i ] = (Parenthesis , opening )
1012
1014
else :
1013
- self . highlighted_paren = (lineno , list (tokens ))
1015
+ highlighted_paren = (lineno , list (tokens ))
1014
1016
# We need to redraw a line
1015
1017
tokens [i ] = (Parenthesis , opening )
1016
1018
self .reprint_line (lineno , tokens )
1017
1019
search_for_paren = False
1018
1020
elif under_cursor :
1019
1021
search_for_paren = False
1022
+ self .highlighted_paren = highlighted_paren
1020
1023
if line != len (self .buffer ):
1021
1024
return list ()
1022
1025
return line_tokens
0 commit comments