[issue42626] readline history, vi-editingmode and ANSI color codes bug

Joakim Nilsson report at bugs.python.org
Sat Dec 12 12:51:50 EST 2020


New submission from Joakim Nilsson <nijoakim at gmail.com>:

Tested on Debian Bullseye with Python 3.9.

If 'set editing-mode vi' is used in .inputrc and the attached program is run, a bug occurs when navigating the readline history. It seems only to occur when ANSI color escape characters are input to the 'input()' function.

To reproduce the bug:
  Run 'readline-example.py'
  Enter '0123456789' in the prompt without quotes.
  Press enter.
  Press escape and then 'k' to go back in history in vi normal mode.
  The cursor is now placed between '2' and '3' and it is impossible to erase anything after the '2'. (To enter vi insert mode, press i and start editing the text normally.)

This bug does not occur for shorter strings. If for example '012345678' is input, the program behaves normally. If the escape characters are not used in the 'input()' function, program behaves normally.

----------
components: Library (Lib)
files: readline-example.py
messages: 382917
nosy: nijoakim
priority: normal
severity: normal
status: open
title: readline history, vi-editingmode and ANSI color codes bug
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49673/readline-example.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42626>
_______________________________________


More information about the Python-bugs-list mailing list