[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Trey Hunner


Trey Hunner  added the comment:

Thank you Steve and Tadek for confirming that this is a readline feature and 
for pointing me to the readline manual. The note about an ~/.inputrc file lead 
me to discover (happily) that I could override this behavior by creating a 
~/.inputrc file with the following line in it:

"\e\C-M": abort Stop Esc Enter from entering vi mode in Python REPL


I'm closing this as "not a bug".

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Tadek Kijkowski


Tadek Kijkowski  added the comment:

This is readline library feature. ESC-enter swithes it to vi mode. Press ESC-e 
to switch is back to emacs mode. See man readline.

--
nosy: +monkeyman79

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Ctrl-C is a red-herring here. Esc-Enter alone is sufficient to switch control 
processing.

Tested in Python 2.7 and 3.9 using xfce4-terminal in Fedora:

1. Ctrl-L clears the terminal window;
2. Type Esc-Enter;
3. Ctrl-L now inserts an actual ^L (chr(12) linefeed) instead of being captured 
by the terminal and clearing the screen.

I am 80% sure this is a *terminal feature* not a Python bug, to allow you to 
insert control characters into the command line, but I can't reproduce it in 
bash or find a way to revert back to normal processing.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Trey Hunner


Trey Hunner  added the comment:

I got some help investigating via a Twitter thread on this topic: 
https://twitter.com/treyhunner/status/1355280273399664642

Here's more context: that combination of keys seems to put readline into vi 
mode, though it only does so in Python and not inside my system shell.

If I type start to type a line of code (say "2+2") and hit Escape and then type 
vi commands like 0 or $, the cursor will navigate to the beginning/end of the 
line as expected in vi mode.

Ctrl-Alt-L clears the screen and typing "Ctrl-A e" enters back into Emacs 
readline mode.

I can understand how "Ctrl-A v" would cause the Python REPL to enter vi mode, 
but I don't understand why "Ctrl-C Escape Enter" would cause that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Trey Hunner


New submission from Trey Hunner :

On Ubuntu Linux 18.04 when I run Python from within a terminal, control keys 
such as Ctrl-L, Ctrl-A, Ctrl-E, and Ctrl-K work as expected.

However, if I type Ctrl-C Escape Enter (^C followed by Esc followed by Return), 
control keys stop working as expected. Ctrl-C still causes KeyboardInterrupt to 
be printed, but pressing Ctrl-L causes "^L" to be shown and Ctrl-A shows "^A".

This happens in Gnome Terminal as well as XTerm both on Ubuntu Linux 18.04. It 
happens in zsh, bash, tcsh, and sh.

I've reproduced this issue in Python 2.7, 3.6, 3.7, 3.8, 3.9, and 3.10. Some of 
these Python versions I installed via pyenv, some came from the deadsnakes PPA, 
and some were preinstalled with Ubuntu.

--
messages: 385957
nosy: trey
priority: normal
severity: normal
status: open
title: Control keys stop working after pressing Ctrl-C Escape Enter
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com