mirror of
https://github.com/nushell/nushell
synced 2025-01-13 13:49:21 +00:00
support bracketed paste (#8907)
# Description Relative: #8113, #7630 It works on non-windows system This pr depends on https://github.com/nushell/reedline/pull/571
This commit is contained in:
parent
7fb48b9a2f
commit
e4625acf24
5 changed files with 14 additions and 3 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -4326,8 +4326,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reedline"
|
name = "reedline"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/nushell/reedline.git?branch=main#65c4e7a419122a526b66adb9695d9d924bf921f6"
|
||||||
checksum = "0b8684e0f5d6fb8529156a19c637645dd7fd5018efbdeaa306f53f54e3b404de"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossterm 0.26.1",
|
"crossterm 0.26.1",
|
||||||
|
|
|
@ -160,7 +160,7 @@ bench = false
|
||||||
# To use a development version of a dependency please use a global override here
|
# 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
|
# changing versions in each sub-crate of the workspace is tedious
|
||||||
[patch.crates-io]
|
[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"}
|
# nu-ansi-term = {git = "https://github.com/nushell/nu-ansi-term.git", branch = "main"}
|
||||||
|
|
||||||
# Criterion benchmarking setup
|
# Criterion benchmarking setup
|
||||||
|
|
|
@ -105,6 +105,12 @@ pub fn evaluate_repl(
|
||||||
);
|
);
|
||||||
|
|
||||||
let config = engine_state.get_config();
|
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"
|
// Setup history_isolation aka "history per session"
|
||||||
let history_isolation = config.history_isolation;
|
let history_isolation = config.history_isolation;
|
||||||
|
|
|
@ -100,6 +100,7 @@ pub struct Config {
|
||||||
pub enable_external_completion: bool,
|
pub enable_external_completion: bool,
|
||||||
pub trim_strategy: TrimStrategy,
|
pub trim_strategy: TrimStrategy,
|
||||||
pub show_banner: bool,
|
pub show_banner: bool,
|
||||||
|
pub bracketed_paste: bool,
|
||||||
pub show_clickable_links_in_ls: bool,
|
pub show_clickable_links_in_ls: bool,
|
||||||
pub render_right_prompt_on_last_line: bool,
|
pub render_right_prompt_on_last_line: bool,
|
||||||
pub explore: HashMap<String, Value>,
|
pub explore: HashMap<String, Value>,
|
||||||
|
@ -144,6 +145,7 @@ impl Default for Config {
|
||||||
enable_external_completion: true,
|
enable_external_completion: true,
|
||||||
trim_strategy: TRIM_STRATEGY_DEFAULT,
|
trim_strategy: TRIM_STRATEGY_DEFAULT,
|
||||||
show_banner: true,
|
show_banner: true,
|
||||||
|
bracketed_paste: true,
|
||||||
show_clickable_links_in_ls: true,
|
show_clickable_links_in_ls: true,
|
||||||
render_right_prompt_on_last_line: false,
|
render_right_prompt_on_last_line: false,
|
||||||
explore: HashMap::new(),
|
explore: HashMap::new(),
|
||||||
|
@ -1212,6 +1214,9 @@ impl Value {
|
||||||
"render_right_prompt_on_last_line" => {
|
"render_right_prompt_on_last_line" => {
|
||||||
try_bool!(cols, vals, index, span, 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 config options (deprecated as of 2022-11-02)
|
||||||
// Legacy options do NOT reconstruct their values on error
|
// Legacy options do NOT reconstruct their values on error
|
||||||
"use_ls_colors" => {
|
"use_ls_colors" => {
|
||||||
|
|
|
@ -294,6 +294,7 @@ let-env config = {
|
||||||
float_precision: 2 # the precision for displaying floats in tables
|
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
|
# 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
|
use_ansi_coloring: true
|
||||||
|
bracketed_paste: true # enable bracketed paste, currently useless on windows
|
||||||
edit_mode: emacs # emacs, vi
|
edit_mode: emacs # emacs, vi
|
||||||
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
|
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.
|
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.
|
||||||
|
|
Loading…
Reference in a new issue