[PT] For new line insertion. #9401

Closed
Carreau opened this Issue Apr 14, 2016 · 9 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
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
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
Member

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

@takluyver takluyver closed this Apr 15, 2016
@jonathanslenders
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
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
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
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
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.

@Carreau Carreau added this to the no action milestone May 20, 2016
@anntzer
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