diff --git a/Cargo.lock b/Cargo.lock index 707c5f0d76..410254a421 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4326,8 +4326,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8684e0f5d6fb8529156a19c637645dd7fd5018efbdeaa306f53f54e3b404de" +source = "git+https://github.com/nushell/reedline.git?branch=main#65c4e7a419122a526b66adb9695d9d924bf921f6" dependencies = [ "chrono", "crossterm 0.26.1", diff --git a/Cargo.toml b/Cargo.toml index 7789785226..c2db39358e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,7 +160,7 @@ bench = false # To use a development version of a dependency please use a global override here # changing versions in each sub-crate of the workspace is tedious [patch.crates-io] -# reedline = { git = "https://github.com/nushell/reedline.git", branch = "main"} +reedline = { git = "https://github.com/nushell/reedline.git", branch = "main"} # nu-ansi-term = {git = "https://github.com/nushell/nu-ansi-term.git", branch = "main"} # Criterion benchmarking setup diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index 8092b9c5f4..62b60ea86e 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -105,6 +105,12 @@ pub fn evaluate_repl( ); let config = engine_state.get_config(); + if config.bracketed_paste { + // try to enable bracketed paste + // It doesn't work on windows system: https://github.com/crossterm-rs/crossterm/issues/737 + #[cfg(not(target_os = "windows"))] + let _ = line_editor.enable_bracketed_paste(); + } // Setup history_isolation aka "history per session" let history_isolation = config.history_isolation; diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index 5842c5f195..088252b52f 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -100,6 +100,7 @@ pub struct Config { pub enable_external_completion: bool, pub trim_strategy: TrimStrategy, pub show_banner: bool, + pub bracketed_paste: bool, pub show_clickable_links_in_ls: bool, pub render_right_prompt_on_last_line: bool, pub explore: HashMap, @@ -144,6 +145,7 @@ impl Default for Config { enable_external_completion: true, trim_strategy: TRIM_STRATEGY_DEFAULT, show_banner: true, + bracketed_paste: true, show_clickable_links_in_ls: true, render_right_prompt_on_last_line: false, explore: HashMap::new(), @@ -1212,6 +1214,9 @@ impl Value { "render_right_prompt_on_last_line" => { try_bool!(cols, vals, index, span, render_right_prompt_on_last_line); } + "bracketed_paste" => { + try_bool!(cols, vals, index, span, bracketed_paste); + } // Legacy config options (deprecated as of 2022-11-02) // Legacy options do NOT reconstruct their values on error "use_ls_colors" => { diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu index 135207f0ce..43190041ad 100644 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ b/crates/nu-utils/src/sample_config/default_config.nu @@ -294,6 +294,7 @@ let-env config = { float_precision: 2 # the precision for displaying floats in tables # buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL use_ansi_coloring: true + bracketed_paste: true # enable bracketed paste, currently useless on windows edit_mode: emacs # emacs, vi shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.