Skip to content

[PT] For new line insertion. #9401

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

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

[PT] For new line insertion. #9401

Carreau opened this issue Apr 14, 2016 · 9 comments
Milestone

Comments

@Carreau
Copy link
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
Copy link
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.

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

@takluyver
Copy link
Member

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

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

@Carreau
Copy link
Member Author

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
Copy link
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.

@Carreau
Copy link
Member Author

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
Copy link
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.

@anntzer
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants