Closed rolandwalker closed 3 years ago
I just noticed _multiline_exception() which is another way that ending a line with \e
could/should be supported.
Do we just need to kick off a new test run to verify that it passes or are we still waiting on changes in this PR?
From our Slack conversation I thought you had an idea about how to change the PR. My only idea was to remove Control-J.
@rolandwalker You could make Control + J binding conditional, and not bind it in unit tests, like this:
import os
from prompt_toolkit.filters import Condition
@Condition
def no_cpr():
"""Only if PROMPT_TOOLKIT_NO_CPR."""
return os.environ.get('PROMPT_TOOLKIT_NO_CPR', '') == '1'
then:
@kb.add('c-j', filter=~no_cpr)
However, I don't know all the implications of overriding the default binding of c-j
. prompt_toolkit
handles c-j
in a few places, example:
maybe @jonathanslenders can advise here?
In the latest push, I am just removing the Control-J binding.
@rolandwalker are you able to rebase this on master?
@j-bennet rebased
👍 Merged. Thank you!
Description
xref #748
Make Alt-Enter context-sensitive, inserting a linefeed in single-line mode, but dispatching the command in multi-line mode.
In short, Alt-Enter mostly inverts the expected action of Enter.
Motivation: I can't find another way to dispatch a command like
in multi-line mode.
Also, make Control-j unconditionally insert linefeed in Emacs mode. Rationale: preserves an easy "unconditional insert" feature. Happy to remove this part, which may be debatable. Edit: and, the Control-j binding may break the assumptions of the test suite.
Note that it was always possible to unconditionally insert linefeeds via quoted-insert (Emacs mode Control-q Control-j, Vi mode Control-v Control-j).
Checklist
changelog.md
.AUTHORS
file (or it's already there).