summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/ParenMatch.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2006-07-20 22:22:52 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2006-07-20 22:22:52 (GMT)
commit43476e009b2f3b9fd6c3d600bb41a0298907bad5 (patch)
treec82c254ed62bb7b16ed22864ec17144d78a29999 /Lib/idlelib/ParenMatch.py
parent3fda93604c8a12318a17f39ad49e59663c3f3a5c (diff)
downloadcpython-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.py7
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