From a5470b23621ad088b1ef3de25dc01d3075756d6c Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:25:31 +1200 Subject: [PATCH] use simpler reedline (#6016) --- Cargo.lock | 3 +-- Cargo.toml | 2 +- crates/nu-cli/Cargo.toml | 2 +- crates/nu-cli/src/repl.rs | 1 - crates/nu-command/Cargo.toml | 2 +- crates/nu-protocol/src/config.rs | 11 ----------- docs/sample_config/default_config.nu | 1 - tests/nu_repl/mod.rs | 4 ++-- 8 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 895ec3852c..95ecdec3de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3851,8 +3851,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d064ec92a21deb048c440b6461ccf0d0babdb5f2160ea9dfac451bc7b4b556e2" +source = "git+https://github.com/nushell/reedline.git#59f7144d721cd573f629048e753f163f2652334f" dependencies = [ "chrono", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index acce21614a..a1f3f9cb4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ nu-system = { path = "./crates/nu-system", version = "0.65.1" } nu-table = { path = "./crates/nu-table", version = "0.65.1" } nu-term-grid = { path = "./crates/nu-term-grid", version = "0.65.1" } nu-utils = { path = "./crates/nu-utils", version = "0.65.1" } -reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]} +reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]} pretty_env_logger = "0.4.0" rayon = "1.5.1" is_executable = "1.0.1" diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 5ca112edb9..4178c69deb 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -18,7 +18,7 @@ nu-protocol = { path = "../nu-protocol", version = "0.65.1" } nu-utils = { path = "../nu-utils", version = "0.65.1" } nu-ansi-term = "0.46.0" nu-color-config = { path = "../nu-color-config", version = "0.65.1" } -reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]} +reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]} crossterm = "0.23.0" miette = { version = "5.1.0", features = ["fancy"] } thiserror = "1.0.31" diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index 11df52226c..1c5dfb0529 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -148,7 +148,6 @@ pub fn evaluate_repl( engine_state: engine_state.clone(), config: config.clone(), })) - .with_animation(config.animate_prompt) .with_validator(Box::new(NuValidator { engine_state: engine_state.clone(), })) diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index 1d057d6d02..b93274bdfe 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -84,7 +84,7 @@ unicode-segmentation = "1.8.0" url = "2.2.1" uuid = { version = "1.1.2", features = ["v4"] } which = { version = "4.2.2", optional = true } -reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]} +reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]} wax = { version = "0.5.0", features = ["diagnostics"] } rusqlite = { version = "0.27.0", features = ["bundled"], optional = true } sqlparser = { version = "0.16.0", features = ["serde"], optional = true } diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index e8aa65ac3a..130c608e58 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -2,8 +2,6 @@ use crate::{ShellError, Span, Value}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; -const ANIMATE_PROMPT_DEFAULT: bool = true; - /// Definition of a parsed keybinding from the config object #[derive(Serialize, Deserialize, Clone, Debug)] pub struct ParsedKeybinding { @@ -56,7 +54,6 @@ pub struct Config { pub color_config: HashMap, pub use_grid_icons: bool, pub footer_mode: FooterMode, - pub animate_prompt: bool, pub float_precision: i64, pub filesize_format: String, pub use_ansi_coloring: bool, @@ -89,7 +86,6 @@ impl Default for Config { color_config: HashMap::new(), use_grid_icons: false, footer_mode: FooterMode::RowCount(25), - animate_prompt: ANIMATE_PROMPT_DEFAULT, float_precision: 4, filesize_format: "auto".into(), use_ansi_coloring: true, @@ -195,13 +191,6 @@ impl Value { eprintln!("$config.footer_mode is not a string") } } - "animate_prompt" => { - if let Ok(b) = value.as_bool() { - config.animate_prompt = b; - } else { - eprintln!("$config.animate_prompt is not a bool") - } - } "float_precision" => { if let Ok(i) = value.as_integer() { config.float_precision = i; diff --git a/docs/sample_config/default_config.nu b/docs/sample_config/default_config.nu index 8c57bd6893..e05a956767 100644 --- a/docs/sample_config/default_config.nu +++ b/docs/sample_config/default_config.nu @@ -243,7 +243,6 @@ let-env config = { quick_completions: true # set this to false to prevent auto-selecting completions when only one remains partial_completions: true # set this to false to prevent partial filling of the prompt completion_algorithm: "prefix" # prefix, fuzzy - animate_prompt: false # redraw the prompt every second float_precision: 2 # 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 diff --git a/tests/nu_repl/mod.rs b/tests/nu_repl/mod.rs index 21b757a9ef..495fbf4f09 100644 --- a/tests/nu_repl/mod.rs +++ b/tests/nu_repl/mod.rs @@ -11,9 +11,9 @@ fn outcome_err( engine_state: &EngineState, error: &(dyn miette::Diagnostic + Send + Sync + 'static), ) -> Outcome { - let working_set = StateWorkingSet::new(&engine_state); + let working_set = StateWorkingSet::new(engine_state); - eprintln!("{}", format!("Error: {:?}", CliError(error, &working_set))); + eprintln!("Error: {:?}", CliError(error, &working_set)); Outcome { out: String::new(),