From ee5064abed2f016400407dc1f6e152adb7c61eff Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sat, 26 Mar 2022 22:57:31 -0500 Subject: [PATCH] Nu ansi term update (#4988) * WIP: Testing 0.45.1 nu-ansi-term with the new Default colors * point reedline to git in cargo.toml --- Cargo.lock | 9 ++++----- Cargo.toml | 2 +- crates/nu-cli/Cargo.toml | 5 +---- crates/nu-color-config/Cargo.toml | 2 -- crates/nu-command/Cargo.toml | 2 +- crates/nu-command/src/platform/ansi/ansi_.rs | 12 ++++++++++-- crates/nu-pretty-hex/Cargo.toml | 3 +-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 34244c8aa..1d3cb63b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2170,9 +2170,9 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280affd8593c03f90633b7305cee7a3b55ddab9fbad95041a39bda689f7b64f7" +checksum = "c7bca0d33a384280d1563b97f49cb95303df9fa22588739a04b7d8015c1ccd50" dependencies = [ "overload", "winapi", @@ -3424,9 +3424,8 @@ dependencies = [ [[package]] name = "reedline" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ba0eb9271feb2de4b1516d651c96d80c892df24388e2711ef2495acc6ed9ce" +version = "0.3.1" +source = "git+https://github.com/nushell/reedline#bc528de132e74594fdd5a9202cf32aee51e921e8" dependencies = [ "chrono", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 43ecf7602..a6c560b9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ nu-term-grid = { path = "./crates/nu-term-grid", version = "0.60.1" } nu-utils = { path = "./crates/nu-utils", version = "0.60.1" } pretty_env_logger = "0.4.0" rayon = "1.5.1" -reedline = "0.3.0" +reedline = { git = "https://github.com/nushell/reedline" } is_executable = "1.0.1" [dev-dependencies] diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 9241d17ca..c1e77514f 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -13,15 +13,12 @@ nu-parser = { path = "../nu-parser", version = "0.60.1" } nu-protocol = { path = "../nu-protocol", version = "0.60.1" } nu-utils = { path = "../nu-utils", version = "0.60.1" } nu-ansi-term = "0.45.0" - nu-color-config = { path = "../nu-color-config", version = "0.60.1" } - crossterm = "0.23.0" crossterm_winapi = "0.9.0" miette = { version = "4.1.0", features = ["fancy"] } thiserror = "1.0.29" -reedline = "0.3.0" - +reedline = { git = "https://github.com/nushell/reedline" } log = "0.4" is_executable = "1.0.1" diff --git a/crates/nu-color-config/Cargo.toml b/crates/nu-color-config/Cargo.toml index 215c071f8..7f395db96 100644 --- a/crates/nu-color-config/Cargo.toml +++ b/crates/nu-color-config/Cargo.toml @@ -9,8 +9,6 @@ version = "0.60.1" [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.60.1" } nu-ansi-term = "0.45.0" - nu-json = { path = "../nu-json", version = "0.60.1" } nu-table = { path = "../nu-table", version = "0.60.1" } - serde = { version="1.0.123", features=["derive"] } diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index b1a640870..b8704fb42 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -77,7 +77,7 @@ unicode-segmentation = "1.8.0" url = "2.2.1" uuid = { version = "0.8.2", features = ["v4"] } which = { version = "4.2.2", optional = true } -reedline = "0.3.0" +reedline = { git = "https://github.com/nushell/reedline" } zip = { version="0.5.9", optional = true } [target.'cfg(unix)'.dependencies] diff --git a/crates/nu-command/src/platform/ansi/ansi_.rs b/crates/nu-command/src/platform/ansi/ansi_.rs index 5f4f17066..e5b308841 100644 --- a/crates/nu-command/src/platform/ansi/ansi_.rs +++ b/crates/nu-command/src/platform/ansi/ansi_.rs @@ -130,6 +130,13 @@ lazy_static! { AnsiCode{ short_name: Some("dgrd"), long_name: "dark_gray_dimmed", code: Color::DarkGray.dimmed().prefix().to_string()}, AnsiCode{ short_name: Some("dgrr"), long_name: "dark_gray_reverse", code: Color::DarkGray.reverse().prefix().to_string()}, + AnsiCode{ short_name: Some("der"), long_name: "default", code: Color::Default.prefix().to_string()}, + AnsiCode{ short_name: Some("deb"), long_name: "default_bold", code: Color::Default.bold().prefix().to_string()}, + AnsiCode{ short_name: Some("deu"), long_name: "default_underline", code: Color::Default.underline().prefix().to_string()}, + AnsiCode{ short_name: Some("dei"), long_name: "default_italic", code: Color::Default.italic().prefix().to_string()}, + AnsiCode{ short_name: Some("ded"), long_name: "default_dimmed", code: Color::Default.dimmed().prefix().to_string()}, + AnsiCode{ short_name: Some("der"), long_name: "default_reverse", code: Color::Default.reverse().prefix().to_string()}, + AnsiCode{ short_name: None, long_name: "reset", code: "\x1b[0m".to_owned()}, // Reference for ansi codes https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 // Another good reference http://ascii-table.com/ansi-escape-sequences.php @@ -247,6 +254,7 @@ following values: 35/95 magenta 45/105 magenta 36/96 cyan 46/106 cyan 37/97 white 47/107 white + 39 default 49 default https://en.wikipedia.org/wiki/ANSI_escape_code OSC: '\x1b]' is not required for --osc parameter @@ -435,8 +443,8 @@ fn generate_ansi_code_list( }; let name: Value = Value::string(String::from(ansi_code.long_name), call_span); let short_name = Value::string(ansi_code.short_name.unwrap_or(""), call_span); - // The first 96 items in the ansi array are colors - let preview = if i < 96 { + // The first 102 items in the ansi array are colors + let preview = if i < 102 { Value::string(format!("{}NUSHELL\u{1b}[0m", &ansi_code.code), call_span) } else { Value::string("\u{1b}[0m", call_span) diff --git a/crates/nu-pretty-hex/Cargo.toml b/crates/nu-pretty-hex/Cargo.toml index 1544af845..01ef7df51 100644 --- a/crates/nu-pretty-hex/Cargo.toml +++ b/crates/nu-pretty-hex/Cargo.toml @@ -16,8 +16,7 @@ name = "nu_pretty_hex" path = "src/main.rs" [dependencies] -nu-ansi-term = "0.45.0" - +nu-ansi-term = "0.45.1" rand = "0.8.3" [dev-dependencies]