Description: use crate nu-ansi-term (not deprecated ansi-term) Author: Jeremy BĂ­cha Origin: upstream, https://github.com/dandavison/delta/pull/2067 Bug: https://github.com/dandavison/delta/pull/2067 Bug-Debian: https://bugs.debian.org/1135356 Last-Update: 2026-08-13 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ [dependencies] ansi_colours = "1.2.1" -ansi_term = "0.12.1" +ansi_term = { package = "nu-ansi-term", version = "0.50"} anstyle-parse = "0.2.3" anyhow = "1.0.70" bat = { version = "0.26.0", default-features = false, features = [ --- a/src/ansi/iterator.rs +++ b/src/ansi/iterator.rs @@ -270,7 +270,7 @@ let r = u8::try_from(params.next()?).ok()?; let g = u8::try_from(params.next()?).ok()?; let b = u8::try_from(params.next()?).ok()?; - Some(ansi_term::Color::RGB(r, g, b)) + Some(ansi_term::Color::Rgb(r, g, b)) } Some(5) => Some(ansi_term::Color::Fixed(u8::try_from(params.next()?).ok()?)), _ => None, --- a/src/color.rs +++ b/src/color.rs @@ -41,17 +41,28 @@ pub fn color_to_string(color: Color) -> String { match color { + Color::Default => todo!(), Color::Fixed(n) if n < 16 => ansi_16_color_number_to_name(n).unwrap().to_string(), Color::Fixed(n) => format!("{n}"), - Color::RGB(r, g, b) => format!("\"#{r:02x?}{g:02x?}{b:02x?}\""), + Color::Rgb(r, g, b) => format!("\"#{r:02x?}{g:02x?}{b:02x?}\""), Color::Black => "black".to_string(), + Color::DarkGray => "bright-black".to_string(), Color::Red => "red".to_string(), + Color::LightRed => "bright-red".to_string(), Color::Green => "green".to_string(), + Color::LightGreen => "bright-green".to_string(), Color::Yellow => "yellow".to_string(), + Color::LightYellow => "bright-yellow".to_string(), Color::Blue => "blue".to_string(), + Color::LightBlue => "bright-blue".to_string(), Color::Purple => "purple".to_string(), + Color::LightPurple => "bright-purple".to_string(), + Color::Magenta => "magenta".to_string(), + Color::LightMagenta => "bright-magenta".to_string(), Color::Cyan => "cyan".to_string(), + Color::LightCyan => "bright-cyan".to_string(), Color::White => "white".to_string(), + Color::LightGray => "bright-white".to_string(), } } @@ -153,35 +164,35 @@ } } -const LIGHT_THEME_MINUS_COLOR: Color = Color::RGB(0xff, 0xe0, 0xe0); +const LIGHT_THEME_MINUS_COLOR: Color = Color::Rgb(0xff, 0xe0, 0xe0); const LIGHT_THEME_MINUS_COLOR_256: Color = Color::Fixed(224); -const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color::RGB(0xff, 0xc0, 0xc0); +const LIGHT_THEME_MINUS_EMPH_COLOR: Color = Color::Rgb(0xff, 0xc0, 0xc0); const LIGHT_THEME_MINUS_EMPH_COLOR_256: Color = Color::Fixed(217); -const LIGHT_THEME_PLUS_COLOR: Color = Color::RGB(0xd0, 0xff, 0xd0); +const LIGHT_THEME_PLUS_COLOR: Color = Color::Rgb(0xd0, 0xff, 0xd0); const LIGHT_THEME_PLUS_COLOR_256: Color = Color::Fixed(194); -const LIGHT_THEME_PLUS_EMPH_COLOR: Color = Color::RGB(0xa0, 0xef, 0xa0); +const LIGHT_THEME_PLUS_EMPH_COLOR: Color = Color::Rgb(0xa0, 0xef, 0xa0); const LIGHT_THEME_PLUS_EMPH_COLOR_256: Color = Color::Fixed(157); -const DARK_THEME_MINUS_COLOR: Color = Color::RGB(0x3f, 0x00, 0x01); +const DARK_THEME_MINUS_COLOR: Color = Color::Rgb(0x3f, 0x00, 0x01); const DARK_THEME_MINUS_COLOR_256: Color = Color::Fixed(52); -const DARK_THEME_MINUS_EMPH_COLOR: Color = Color::RGB(0x90, 0x10, 0x11); +const DARK_THEME_MINUS_EMPH_COLOR: Color = Color::Rgb(0x90, 0x10, 0x11); const DARK_THEME_MINUS_EMPH_COLOR_256: Color = Color::Fixed(124); -const DARK_THEME_PLUS_COLOR: Color = Color::RGB(0x00, 0x28, 0x00); +const DARK_THEME_PLUS_COLOR: Color = Color::Rgb(0x00, 0x28, 0x00); const DARK_THEME_PLUS_COLOR_256: Color = Color::Fixed(22); -const DARK_THEME_PLUS_EMPH_COLOR: Color = Color::RGB(0x00, 0x60, 0x00); +const DARK_THEME_PLUS_EMPH_COLOR: Color = Color::Rgb(0x00, 0x60, 0x00); const DARK_THEME_PLUS_EMPH_COLOR_256: Color = Color::Fixed(28); --- a/src/features/line_numbers.rs +++ b/src/features/line_numbers.rs @@ -103,7 +103,7 @@ )) } -/// Return a vec of `ansi_term::ANSIGenericString`s representing the left and right fields of the +/// Return a vec of `ansi_term::AnsiGenericString`s representing the left and right fields of the /// two-column line number display. pub fn format_and_paint_line_numbers<'a>( line_numbers_data: &'a LineNumbersData, @@ -111,7 +111,7 @@ styles: MinusPlus