Escape then enter intended as two separate key presses is a very common
sequence when using vi mode - returning to normal mode from insert mode
(escape) and then submitting the query (enter). The presence of the
escape-enter key binding overrides this behaviour by inserting
undesirable newlines (newline is be easily inserted when in insert mode
by pressing enter) or by introducing a noticable delay/lag before enter
can be pressed after escape, due to prompt toolkit not being able to
recognise escape immediately (since it may form part of an escape-enter
sequence).
Use a (conditional) Enter key-binding to force-handle a multi-line
buffer, rather than doing so by (conditionally) disabling the multiline
mode of prompt_toolkit.
This has the benefit of being more efficient (the multiline Condition
filter is called very often, which (due to the repeated query parsing)
causes editing to become slow with a large buffer that ends in a
semicolon), clearer in intent (we want to force-handle the query, rather
than (temporarily) disable multiline mode which indirectly forces the
buffer to be handled) and avoids a bug in multi-line history search
(issue #1031)
* added black to develop guide
* no need for pep8radius.
* changelog.
* Add pre-commit checkbox.
* Add pre-commit to dev reqs.
* Add pyproject.toml for black.
* Pre-commit config.
* Add black to travis and dev reqs.
* Install and run black in travis.
* Remove black from dev reqs.
* Lower black target version.
* Re-format with black.
* Cherry-picked prompt-toolkit 2.0 changes.
* Increase help timeout.
* Missed one.
* Fixes editor command.
* Expect exact to fix named query error.
* Unicode is non-optional with ptk 2.0.
* Unicode literals all the things (almost).
* PEP8.
* Change how we swap completers.
* By default, bottom toolbar styles are reversed. We don't want that.
* Adapt styles to 2.0.
* The future is now. Switch to ptk 2.0 style names.
* PEP8.
* Flag for enable_open_in_editor.
* add class:prompt to prompt
* Removed workaround for #668. Some renaming.
* use pgcli.completer instead of app.current_buffer.completer
* enable_system_prompt=True like old prompt toolkit
* keep search_ignore_case enabled (was ignore_case)
* fix closing parenthese
* keep marking class:continuation token for continuation
* capture KeyboardInterrupt manually
AbortAction has been removed in Prompt_toolkit 2.0
* replace C-J with enter, add more comments
* reversed ([...]) to [(...)] (oops)
* pep8 fixes
* Does Vi mode have to be applied to session every time?
* (workaround) also enable vi_mode after edit command
* Fixed test errors after rebasing on master.