diff -r 174c30103b57 Lib/idlelib/HyperParser.py --- a/Lib/idlelib/HyperParser.py Sat Jun 14 09:27:10 2014 +0100 +++ b/Lib/idlelib/HyperParser.py Sat Jun 14 12:39:12 2014 +0300 @@ -14,7 +14,7 @@ class HyperParser: - def __init__(self, editwin, index): + def __init__(self, editwin, index, end_at_eol=True): """Initialize the HyperParser to analyze the surroundings of the given index. """ @@ -32,7 +32,7 @@ for context in editwin.num_context_lines: startat = max(lno - context, 1) startatindex = repr(startat) + ".0" - stopatindex = "%d.end" % lno + stopatindex = "%d.end" % lno if end_at_eol else "end-1c" # We add the newline because PyParse requires a newline at end. # We add a space so that index won't be at end of line, so that # its status will be the same as the char before it, if should. @@ -48,7 +48,14 @@ startatindex = r[1] else: startatindex = "1.0" - stopatindex = "%d.end" % lno + if end_at_eol: + stopatindex = "%d.end" % lno + else: + r = text.tag_nextrange("console", index) + if r: + stopatindex = text.index(r[0] + "-1c") + else: + stopatindex = "end-1c" # We add the newline because PyParse requires a newline at end. # We add a space so that index won't be at end of line, so that # its status will be the same as the char before it, if should. diff -r 174c30103b57 Lib/idlelib/ParenMatch.py --- a/Lib/idlelib/ParenMatch.py Sat Jun 14 09:27:10 2014 +0100 +++ b/Lib/idlelib/ParenMatch.py Sat Jun 14 12:39:12 2014 +0300 @@ -90,7 +90,8 @@ self.set_timeout = self.set_timeout_none def flash_paren_event(self, event): - indices = HyperParser(self.editwin, "insert").get_surrounding_brackets() + hp = HyperParser(self.editwin, "insert", end_at_eol=False) + indices = hp.get_surrounding_brackets() if indices is None: self.warn_mismatched() return