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

Restore previous key bindings. #9572

Merged
merged 3 commits into from Jun 9, 2016

Conversation

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

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.
@jonathanslenders

This comment has been minimized.

Show comment
Hide comment
@jonathanslenders

jonathanslenders Jun 8, 2016

Contributor

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.

Contributor

jonathanslenders commented Jun 8, 2016

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

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Jun 8, 2016

Member

Ok, thanks !

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