Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork246
Description
(Thiscomplements#22, it is not a duplicate.)
While inputting a multi-line form (e.g. a function or class), bpython does not let me cursor back to a previous line (e.g. to fix a typo).
Note, this is orthogonal and complementary to working with multi-line entries from history, which is already tracked by#22.
Repro
- (Optional/recommended) Move aside your history file for exact reproducibility, as this occurs regardless of history
mv ~/.pythonhist{,.bak}
- Run
bpython
, and input at least the first line of any multi-line form
❯ bpythonbpython version 0.24 on top of Python 3.11.7 ...>>> def foo():...
- Try to navigate back to the previous line (e.g. via Up arrow or Ctrl+P, or by pressing Alt+B multiple times to jump backward by word, which works across lines in other REPLs such as IPython)
Expected
You can move the cursor to the previous line (and then make any necessary changes to it before going back to the next line).
Observed
You can't move the cursor to a previous line. It stays stuck in the current line.
Prior Art
This works in other REPLs such as IPython:
Screen.Recording.2024-03-26.at.10.48.58.AM.mov
Workarounds
- Press C-x to open the current block in your default text editor.
Besides requiring extra steps/friction and being less discoverable, a major downside of this workaround is that, if your text editor opens "on top of" bpython in the same terminal (e.g. you use vim, you're not in a GUI environment where your editor can open in a new desktop window, etc.), then you lose the context of your previous input in your bpython session, which you may need to refer to for your current input.
- Press F7 to open the current session in your default text editor.
This avoids the loss of context of the C-x workaround, but still requires more steps and mental overhead to make a simple change like a typo fix to the previous line.