Issue 22923: No prompt for "display all X possibilities" on completion-enabled input() (original) (raw)
When running input() (or raw_input() for Python 2) while tab-completion has been enabled using readline.parse_and_bind('tab: complete')
, pressing the tab key twice display the message Display all X possibilities? (y or n)
when there are more than 100 remaining possibilities (default value). However, I am not asked any input to answer the question, and readline then proceeds to display all possibilities.
Steps to reproduce:
- run the following code:
__import__('readline').parse_and_bind('tab:complete');input()"
- press tab twice
If your current directory has more than 100 files, the message Display all X possibilities? (y or n)
should show, following by a list of the files.
The bug still shows up with:
- rlcompleter or custom completer
- versions 2.7.3, 2.7.8, 3.2.3 and 3.4.2
- bash or zsh
- tty, screen, ssh+screen, xterm, urxvt, gnome-terminal
- command-line flags -S (no
site
module), -u (unbuffered) or -Su - being run as script, as
-c
command-line argument, or in the interactive interpreter import readline;readline.
orfrom readline import *
in stead of__import__('readline').
On the other hand, the C program "#include <readline/readline.h>", "main(){readline(0);}" behaves as expected: after the message is displayed, user input is waited for and typing "y" lists the possibilities, "n" resumes the line editing, and anything else is ignored.