feat: support backeted paste (#117)

pull/118/head
sigoden 1 year ago committed by GitHub
parent a7b31d4367
commit 065a32decb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

556
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -19,13 +19,13 @@ eventsource-stream = "0.2.3"
futures-util = "0.3.26" futures-util = "0.3.26"
inquire = "0.5.3" inquire = "0.5.3"
is-terminal = "0.4.4" is-terminal = "0.4.4"
reedline = "0.16.0" reedline = "0.19.0"
serde = { version = "1.0.152", features = ["derive"] } serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93" serde_json = "1.0.93"
serde_yaml = "0.9.17" serde_yaml = "0.9.17"
tokio = { version = "1.26.0", features = ["full"] } tokio = { version = "1.26.0", features = ["full"] }
crossbeam = "0.8.2" crossbeam = "0.8.2"
crossterm = "0.24.0" crossterm = "0.26.1"
chrono = "0.4.23" chrono = "0.4.23"
atty = "0.2.14" atty = "0.2.14"
unicode-width = "0.1.10" unicode-width = "0.1.10"
@ -37,7 +37,7 @@ fancy-regex = "0.11.0"
base64 = "0.21.0" base64 = "0.21.0"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
bstr = "1.3.0" bstr = "1.3.0"
nu-ansi-term = "0.46.0" nu-ansi-term = "0.47.0"
[dependencies.reqwest] [dependencies.reqwest]
version = "0.11.14" version = "0.11.14"
@ -49,6 +49,9 @@ version = "5.0.0"
default-features = false default-features = false
features = ["parsing", "regex-onig"] features = ["parsing", "regex-onig"]
[patch.crates-io]
reedline = { git = "https://github.com/nushell/reedline.git", branch = "main"}
[profile.release] [profile.release]
lto = true lto = true
strip = true strip = true

@ -30,7 +30,7 @@ impl Repl {
let history = Self::create_history()?; let history = Self::create_history()?;
let menu = Self::create_menu(); let menu = Self::create_menu();
let edit_mode = Box::new(Emacs::new(keybindings)); let edit_mode = Box::new(Emacs::new(keybindings));
let editor = Reedline::create() let mut editor = Reedline::create()
.with_completer(Box::new(completer)) .with_completer(Box::new(completer))
.with_highlighter(Box::new(highlighter)) .with_highlighter(Box::new(highlighter))
.with_history(history) .with_history(history)
@ -40,6 +40,7 @@ impl Repl {
.with_partial_completions(true) .with_partial_completions(true)
.with_validator(Box::new(ReplValidator)) .with_validator(Box::new(ReplValidator))
.with_ansi_colors(true); .with_ansi_colors(true);
editor.enable_bracketed_paste()?;
let prompt = ReplPrompt::new(config); let prompt = ReplPrompt::new(config);
Ok(Self { editor, prompt }) Ok(Self { editor, prompt })
} }

@ -98,8 +98,10 @@ impl Repl {
".clear" => match args { ".clear" => match args {
Some("screen") => term::clear_screen(0)?, Some("screen") => term::clear_screen(0)?,
Some("history") => { Some("history") => {
let history = Box::new(self.editor.history_mut()); self.editor
history.clear().with_context(|| "Failed to clear history")?; .history_mut()
.clear()
.with_context(|| "Failed to clear history")?;
print_now!("\n"); print_now!("\n");
} }
Some("role") => handler.handle(ReplCmd::ClearRole)?, Some("role") => handler.handle(ReplCmd::ClearRole)?,

Loading…
Cancel
Save