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

[PT] For new line insertion. #9401

Closed
Carreau opened this Issue Apr 14, 2016 · 9 comments

Comments

Projects
None yet
4 participants
@Carreau
Member

Carreau commented Apr 14, 2016

Currently in prompt toolkit, Esc-Enter force execution, is there a way to get "force" a new line with a shortcut like Shift-Enter ?

I know there is already Ctrl-O to add a line without moving the cursor but a <modifier>-<enter> seem more natural.

Ping @jonathanslenders the PT master.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 14, 2016

Member

I think I already asked about this in the comments of a previous issue, and the answer was no, there's no other modifier+enter we can detect. Ctrl+Enter also works to force execution, but it is detected the same as esc+enter.

Member

takluyver commented Apr 14, 2016

I think I already asked about this in the comments of a previous issue, and the answer was no, there's no other modifier+enter we can detect. Ctrl+Enter also works to force execution, but it is detected the same as esc+enter.

@jonathanslenders

This comment has been minimized.

Show comment
Hide comment
@jonathanslenders

jonathanslenders Apr 15, 2016

Contributor

This is indeed a limitation of the vt100 protocol. Control-Enter is the same as Enter.
Meta+Enter is the only one that we can detect.

Contributor

jonathanslenders commented Apr 15, 2016

This is indeed a limitation of the vt100 protocol. Control-Enter is the same as Enter.
Meta+Enter is the only one that we can detect.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 15, 2016

Member

(Oh right, I mis-spoke about Ctrl-Enter - it is Alt-Enter that forces execution)

Member

takluyver commented Apr 15, 2016

(Oh right, I mis-spoke about Ctrl-Enter - it is Alt-Enter that forces execution)

@takluyver takluyver closed this Apr 15, 2016

@jonathanslenders

This comment has been minimized.

Show comment
Hide comment
@jonathanslenders

jonathanslenders Apr 19, 2016

Contributor

What about using Keys.ControlBackslash for inserting a newline? I just realised that this could work and is the most intuitive we can get. Backslash is often associated with newlines, because it's used to escape them, and given that it's just above the enter key, it should be easy to remember.

Contributor

jonathanslenders commented Apr 19, 2016

What about using Keys.ControlBackslash for inserting a newline? I just realised that this could work and is the most intuitive we can get. Backslash is often associated with newlines, because it's used to escape them, and given that it's just above the enter key, it should be easy to remember.

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Apr 19, 2016

Member

and given that it's just above the enter key

On english keyboard :-) IIRC (haven't tried in a while) it's Alt-Shift-Slash on Mac-French, and AltGr-8 on Windows-French for example.

Member

Carreau commented Apr 19, 2016

and given that it's just above the enter key

On english keyboard :-) IIRC (haven't tried in a while) it's Alt-Shift-Slash on Mac-French, and AltGr-8 on Windows-French for example.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 19, 2016

Member

On American keyboards. On really English keyboards, it's in the bottom left, beside shift. That's actually quite convenient to chord with Ctrl, though.

However, at least on my system, Ctrl+backslash is already in use to suspend and background a process (i.e. start IPython, hit Ctrl-, you're back in bash. Type fg 1 and you're in IPython again). So I'd rather not interfere with that.

How about Ctrl-N? That's not used for anything on my system.

Member

takluyver commented Apr 19, 2016

On American keyboards. On really English keyboards, it's in the bottom left, beside shift. That's actually quite convenient to chord with Ctrl, though.

However, at least on my system, Ctrl+backslash is already in use to suspend and background a process (i.e. start IPython, hit Ctrl-, you're back in bash. Type fg 1 and you're in IPython again). So I'd rather not interfere with that.

How about Ctrl-N? That's not used for anything on my system.

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Apr 19, 2016

Member

How about Ctrl-N? That's not used for anything on my system.

I believe some people like to make new windows for their terminal.

I'm not sure a "force new line" is that useful. And we'll figure out a way to make that configurable.
Right ?

Member

Carreau commented Apr 19, 2016

How about Ctrl-N? That's not used for anything on my system.

I believe some people like to make new windows for their terminal.

I'm not sure a "force new line" is that useful. And we'll figure out a way to make that configurable.
Right ?

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 19, 2016

Member

Do we know of any system where Ctrl-N makes a new terminal window? On the Linuxes I use, application shortcuts that would be Ctrl-<something> normally tend to be Ctrl-Shift-<something> for the terminal, so it's Ctrl-Shift-N to create a new terminal window. On Mac, I assume it's Cmd-N instead. And I assume it doesn't do anything that helpful on Windows.

I agree that force-new-line is not essential, though - we have lived without it for years, after all.

Member

takluyver commented Apr 19, 2016

Do we know of any system where Ctrl-N makes a new terminal window? On the Linuxes I use, application shortcuts that would be Ctrl-<something> normally tend to be Ctrl-Shift-<something> for the terminal, so it's Ctrl-Shift-N to create a new terminal window. On Mac, I assume it's Cmd-N instead. And I assume it doesn't do anything that helpful on Windows.

I agree that force-new-line is not essential, though - we have lived without it for years, after all.

@anntzer

This comment has been minimized.

Show comment
Hide comment
@anntzer

anntzer Jun 14, 2016

Contributor

FWIW, KDE's konsole passes shift-enter as the three characters(??) "OM", so that could work perhaps? (even if not available on all terminals)

Contributor

anntzer commented Jun 14, 2016

FWIW, KDE's konsole passes shift-enter as the three characters(??) "OM", so that could work perhaps? (even if not available on all terminals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment