knz / go-libedit

Go wrapper around the BSD libedit replacement to GNU readline
Apache License 2.0
6 stars 6 forks source link

support bracketed paste mode #4

Closed benesch closed 6 years ago

benesch commented 6 years ago

Bracketed paste mode is a relatively new feature of terminal emulators whereby pasted text is demarcated by ANSI escape codes. This makes it possible to suspend processing of editline bindings so that pasted text can be incorporated into the current line as-is. In particular, this means pasting SQL statements with tabs in the CockroachDB SQL shell will no longer produce "tab completion unsupported" messages.

This patch turns on bracketed paste mode for all terminals whose "me" cap uses a recognized ANSI escape code. (Termcap unfortunately does not have an entry for bracketed paste mode.) As long as the terminal is ANSIish, the bracketed paste escape codes will either properly enable/disable bracketed paste mode or be silently ignored.

Addresses cockroachdb/cockroach#22706.

knz commented 6 years ago

This suggests screen was modified to support it: https://gist.github.com/ddan39/4137263 Not sure this made it to the main screen dist?

benesch commented 6 years ago

This suggests screen was modified to support it: https://gist.github.com/ddan39/4137263 Not sure this made it to the main screen dist?

Good point. The version of screen that ships with macOS is ancient. Modern versions of screen do indeed support bracketed paste.

benesch commented 6 years ago

Thanks for the reviews!