Restore previous key bindings. #9572

Merged
merged 3 commits into from Jun 9, 2016

Projects

None yet

2 participants

@Carreau
Member
Carreau commented Jun 7, 2016

Esc dismiss the completer on next loop tick, or next keypress (technical
limitation) then clear the prompt.

ControlC dismiss the completer without clearing the buffer first.

Closes #9564
Closes #9554
Bump #9556 To feature request.

Thanks to @chris-b1 and @klonuo for pointing that out.

@jonathanslenders, is there a way to get rid if the delay introduced after pressing escape ?

@Carreau Carreau added this to the 5.0 milestone Jun 7, 2016
@Carreau Carreau Restore previous key bindings.
Esc dismiss the completer on next loop tick, or next keypress (technical
limitation) then clear the prompt.

ControlC dismiss the completer without clearing the buffer first.

Closes #9564
Closes #9554
Bump #9556 To feature request.
4da4b40
@jonathanslenders
Contributor
jonathanslenders commented Jun 8, 2016 edited

I didn't test it, but don't merge it like that. eager=True means that it will replace other key bindings that start with escape. This means that key bindings like meta-b, meta-l'',meta-fetc... won't work anymore. The reason is that when alt is pressed in front of a key binding, a VT terminal sends two keys through the input. Esc + the actual key. So pressing escape, followed by 'b' is the same as typingalt-b`.

This is also the reason that there is a delay after escape. If a normal escape has been pressed and nothing follows right after it. (There is a small timer), then we consider it a normal escape press. This timeout is also noticeable when using Vim and going back to navigation mode.

For Vi users, it would be very confusing to have esc just hide the completion menu. It can do that as well, but it should at least go to navigation mode. For Emacs users, you want to make sure not to shadow all the other meta-style key bindings. It could work by chaining the HasCompletions filter: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/filters/cli.py#L79

Because of this complexity, I preferred to have Ctrl-G to hide the completion menu. I think this is what Emacs is doing.

@Carreau
Member
Carreau commented Jun 8, 2016

Ok, thanks !

@Carreau Carreau merged commit f16c803 into ipython:master Jun 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Carreau Carreau deleted the Carreau:fix-some-keybindings branch Jun 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment