[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

Terry J. Reedy report at bugs.python.org
Sat Jun 14 23:41:57 CEST 2014


Terry J. Reedy added the comment:

The current behavior is documented, if not exactly 'chosen' as the best possible. "return the indices of the opening bracket and the closing bracket (or the end of line, whichever comes first". 

As you note, the automatic matching when pausing afte typing a closer only needs to search back, and that should not be affected. When I type ^0, I am willing to wait the extra 1/20? of a second to get a proper highlight.

To see if anything might depend on the truncated search, I grepped

Searching 'get_surrounding_brackets' in C:\Programs\Python34\Lib\idlelib\*.py ...
CallTips.py: 66:         sur_paren = hp.get_surrounding_brackets('(')
HyperParser.py: 105:     def get_surrounding_brackets(self, openers='([{', mustclose=False):
ParenMatch.py: 93:         indices = HyperParser(self.editwin, "insert").get_surrounding_brackets()
ParenMatch.py: 109:         indices = hp.get_surrounding_brackets(_openers[closer], True)

So we have to make sure that calltips are not disabled or burdened. (The 'testing' you said is needed.)

I don't understand the call because the goal is to find the expression preceding '('. There usually is no matching ')' after '(' just typed.  I just know that unless unless evalfuncs is True, calltips are not fetched when the function expression contains a function call. 'f(' gives a calltip for f, but 'f()(' does not call f to give a calltip for f().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21756>
_______________________________________


More information about the Python-bugs-list mailing list