From cfac8e84dde2bc2a3b72067effe238cfa99ab748 Mon Sep 17 00:00:00 2001 From: Wyatt Carss Date: Tue, 13 Oct 2020 02:33:36 -0400 Subject: [PATCH] Disable rustyline bracketed paste mode by default (#2659) Multiline pastes wait for the user to hit enter before running, because they enter a special paste mode in rustyline called 'bracketed paste' by default. This commit disables that mode by default for nushell, causing multiline pastes to be executed immediately, treating each new line as a separate command. --- crates/nu-cli/src/cli.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index f38205b8e2..37e26012c8 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -669,6 +669,9 @@ fn default_rustyline_editor_configuration() -> Editor { Cmd::Move(Movement::ForwardWord(1, At::AfterEnd, Word::Vi)), ); + // workaround for multiline-paste hang in rustyline (see https://github.com/kkawakam/rustyline/issues/202) + rl.bind_sequence(KeyPress::BracketedPasteStart, rustyline::Cmd::Noop); + // Let's set the defaults up front and then override them later if the user indicates // defaults taken from here https://github.com/kkawakam/rustyline/blob/2fe886c9576c1ea13ca0e5808053ad491a6fe049/src/config.rs#L150-L167 rl.set_max_history_size(100);