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
This commit is contained in:
Darren Schroeder 2022-03-26 22:57:31 -05:00 committed by GitHub
parent 82e3bb0f38
commit ee5064abed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 17 deletions

9
Cargo.lock generated
View file

@ -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",

View file

@ -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]

View file

@ -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"

View file

@ -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"] }

View file

@ -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]

View file

@ -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)

View file

@ -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]