Skip to content

New REPL and readline's vi editing-mode #118840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tmontes opened this issue May 9, 2024 · 1 comment
Closed

New REPL and readline's vi editing-mode #118840

tmontes opened this issue May 9, 2024 · 1 comment
Labels
3.13 bugs and security fixes topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@tmontes
Copy link

tmontes commented May 9, 2024

Bug report

Bug description:

Hi Python devs,

Trying out the new 3.13 REPL(love the improvement!) I faced a behaviour bump on my setup: I configure readline to be in vi editing mode, having a single set editing-mode vi line on my ~/.inputrc -- I'm running macOS 12.7.4 but the same behaviour is observed on Linux.

Observed behaviour:

  1. Launch python REPL with python.
  2. Prompt is coloured, as expected.
  3. Type in import sys.
  4. Hit ESC then k -- the equivalent of "give me the previous line".
  5. Nothing happens.
  6. Hit the up arrow, instead.
  7. This time the previous line, import sys, is restored.

Expected behaviour -- hitting ESC then k should restore the previous line and, in general, hitting ESC should go into "vi command mode" (not sure how this will work with multi-line history entries, but that is yet to be explored).

However:

  • When running with PYTHON_BASIC_REPL=1 the vi mode line editing works.

Since I'm running macOS and it does not ship readline, I figured I needed a better diagnostic (not sure if www.python.org's macOS Python bundles it -- it seems so, but I digged deeper).
On a Rocky Linux 9 host:

  • Cloned the git repo.
  • Checked out the 3.13 branch.
  • Installed all lib dependencies including readline-devel.
  • Built commit c4b853f2a5a4601806f503f1833dce3a4e8d2b58:
    $ ./configure --with-pydebug
    $ make -s -j2
    
  • The resulting ./python executable shows the same behaviour -- readline's vi editing mode does not seem to be respected.

I did not look deeper into the code but I will be glad to assist in the diagnostic/fixing of this -- hoping that going forward, with a more powerful REPL, I can still leverage my finger memory from years of using vi.

Thanks again.

CPython versions tested on:

3.13

Operating systems tested on:

Linux, macOS

@tmontes tmontes added the type-bug An unexpected behavior, bug, or error label May 9, 2024
@AlexWaygood AlexWaygood added topic-repl Related to the interactive shell 3.13 bugs and security fixes labels May 10, 2024
@ambv
Copy link
Contributor

ambv commented May 21, 2024

The new REPL will not be implementing inputrc support, and consequently there won't be a vi editing mode. Use PYTHON_BASIC_REPL for that, this is not going away.

@ambv ambv closed this as completed May 21, 2024
@ambv ambv closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
arizvisa added a commit to arizvisa/dotfiles that referenced this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants