Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Closed
Description
Bug report
Bug description:
When editing the last line in a function in the new REPL, hitting Enter doesn't end the block if the last line has indentation on it.
Demo of the bug,demo of what IPython does
Originally posted in#111201 (comment)
Here are the noticeable differences in how IPython handles this situation:
- When hitting the up arrow key to edit the block, the final blank line isn't included (the default cursor position is at the end of the last non-empty line.
- In IPython I tried purposely adding extra whitespace-only lines (not fully blank but instead containing 4 spaces) by hitting Enter, up arrow, End, Enter, up arrow, End, repeatedly. If I then hit Enter on the first line-followed-by-whitespace-only-lines it ends the block.
- Hitting up arrow again, will strip whitespace from the end of the block (maybe this is how 1 above is implemented)
Implementing the behavior of 1 (or 3) above might be enough, though 2 seems like it would be even better.
CPython versions tested on:
3.13
Operating systems tested on:
Linux