diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2006-07-20 22:22:52 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2006-07-20 22:22:52 (GMT) |
commit | 43476e009b2f3b9fd6c3d600bb41a0298907bad5 (patch) | |
tree | c82c254ed62bb7b16ed22864ec17144d78a29999 /Lib/idlelib/ParenMatch.py | |
parent | 3fda93604c8a12318a17f39ad49e59663c3f3a5c (diff) | |
download | cpython-43476e009b2f3b9fd6c3d600bb41a0298907bad5.zip cpython-43476e009b2f3b9fd6c3d600bb41a0298907bad5.tar.gz cpython-43476e009b2f3b9fd6c3d600bb41a0298907bad5.tar.bz2 |
Avoid occasional failure to detect closing paren properly.
Patch 1407280 Tal Einat
M ParenMatch.py
M NEWS.txt
M CREDITS.txt
Diffstat (limited to 'Lib/idlelib/ParenMatch.py')
-rw-r--r-- | Lib/idlelib/ParenMatch.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/idlelib/ParenMatch.py b/Lib/idlelib/ParenMatch.py index 673aee2..250ae8b 100644 --- a/Lib/idlelib/ParenMatch.py +++ b/Lib/idlelib/ParenMatch.py @@ -8,7 +8,7 @@ parentheses, square brackets, and curly braces. from HyperParser import HyperParser from configHandler import idleConf -keysym_opener = {"parenright":'(', "bracketright":'[', "braceright":'{'} +_openers = {')':'(',']':'[','}':'{'} CHECK_DELAY = 100 # miliseconds class ParenMatch: @@ -100,12 +100,13 @@ class ParenMatch: def paren_closed_event(self, event): # If it was a shortcut and not really a closing paren, quit. - if self.text.get("insert-1c") not in (')',']','}'): + closer = self.text.get("insert-1c") + if closer not in _openers: return hp = HyperParser(self.editwin, "insert-1c") if not hp.is_in_code(): return - indices = hp.get_surrounding_brackets(keysym_opener[event.keysym], True) + indices = hp.get_surrounding_brackets(_openers[closer], True) if indices is None: self.warn_mismatched() return |