After making a typo in IDLE, I noticed some unexpected calltips and incorrectly matched parentheses. These seem to be caused by the parser not knowing where the current prompt begins. I'll try to send in a PR tonight.
Examples
Parentheses are incorrectly matched:
>>> (12
...
SyntaxError: '('wasneverclosed>>> ) # IDLE highlights this as the closing paren
I verified examples 1 and 3 on macOS and Windows. They are specific to Shell in that only Shell gets SyntaxError messages mixed in with code to be executed. Put the same text (without the prompts*) in an IDLE code editor and the behavior is correct.
Prompts are now in a sidebar, not in the tkinter Text window hyperparser sees.
The immediate fix is that hyperparser know when it is in Shell and when so, treat the code-begin mark as beginning of file. A different fix that I have already planned it to not mix SyntaxError and new prompts into the new code area. Instead intercept it and display the message in the status bar or a popup. The latter is used (currently) for editor windows, but I have thought of changing for short messages.
I also want to replace using one Text for both history/output and code input, with a movable boundary between, and instead use different widgets for the different functions.
Activity
terryjreedy commented on Sep 25, 2024
I verified examples 1 and 3 on macOS and Windows. They are specific to Shell in that only Shell gets SyntaxError messages mixed in with code to be executed. Put the same text (without the prompts*) in an IDLE code editor and the behavior is correct.
The immediate fix is that hyperparser know when it is in Shell and when so, treat the code-begin mark as beginning of file. A different fix that I have already planned it to not mix SyntaxError and new prompts into the new code area. Instead intercept it and display the message in the status bar or a popup. The latter is used (currently) for editor windows, but I have thought of changing for short messages.
I also want to replace using one Text for both history/output and code input, with a movable boundary between, and instead use different widgets for the different functions.