From 5c3f7bcc90bae7883f1a0d608c45f71bf1604495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=B1=AA?= <504595380@qq.com> Date: Wed, 30 Oct 2024 21:30:53 +0800 Subject: [PATCH] support sourcemap (#21) * support sourcemap * support sourcemap * support sourcemap --- ansi2-wasm/src/lib.rs | 4 + ansi2/Cargo.toml | 3 + ansi2/src/ans.rs | 5 +- ansi2/src/canvas.rs | 452 +++ ansi2/src/css.rs | 1 + ansi2/src/html.rs | 16 +- ansi2/src/lex.rs | 536 +++- ansi2/src/lib.rs | 378 +-- ansi2/src/main.rs | 9 +- ansi2/src/node.rs | 59 + ansi2/src/snapshots/ansi2__test__base-2.snap | 1880 ++++++++++++ ansi2/src/snapshots/ansi2__test__base-3.snap | 280 ++ ansi2/src/snapshots/ansi2__test__base.snap | 660 +++- ansi2/src/snapshots/ansi2__test__color24.snap | 16 +- .../snapshots/ansi2__test__color256-2.snap | 80 + .../snapshots/ansi2__test__color256-3.snap | 80 + .../src/snapshots/ansi2__test__color256.snap | 56 +- ansi2/src/snapshots/ansi2__test__dim-2.snap | 280 ++ ansi2/src/snapshots/ansi2__test__dim-3.snap | 40 + ansi2/src/snapshots/ansi2__test__dim.snap | 122 +- .../snapshots/ansi2__test__empty_link-2.snap | 200 ++ .../snapshots/ansi2__test__empty_link-3.snap | 40 + .../snapshots/ansi2__test__empty_link.snap | 84 +- .../src/snapshots/ansi2__test__fastfetch.snap | 36 +- ansi2/src/snapshots/ansi2__test__link-2.snap | 2600 ++++++++++++++++ ansi2/src/snapshots/ansi2__test__link-3.snap | 40 + ansi2/src/snapshots/ansi2__test__link.snap | 828 +++-- .../snapshots/ansi2__test__link_hide-2.snap | 1240 ++++++++ .../snapshots/ansi2__test__link_hide-3.snap | 40 + .../src/snapshots/ansi2__test__link_hide.snap | 388 ++- .../src/snapshots/ansi2__test__link_id-2.snap | 200 ++ .../src/snapshots/ansi2__test__link_id-3.snap | 40 + ansi2/src/snapshots/ansi2__test__link_id.snap | 14 +- .../src/snapshots/ansi2__test__link_ll-2.snap | 240 ++ .../snapshots/ansi2__test__link_ll-2.snap.new | 85 - .../src/snapshots/ansi2__test__link_ll-3.snap | 40 + ansi2/src/snapshots/ansi2__test__link_ll.snap | 14 +- .../ansi2__test__link_no_close-2.snap | 2680 +++++++++++++++++ .../ansi2__test__link_no_close-2.snap.new | 817 ----- .../ansi2__test__link_no_close-3.snap | 120 + .../snapshots/ansi2__test__link_no_close.snap | 40 +- .../ansi2__test__link_soft_reset-2.snap | 240 ++ .../ansi2__test__link_soft_reset-2.snap.new | 91 - .../ansi2__test__link_soft_reset-3.snap | 80 + .../ansi2__test__link_soft_reset.snap | 50 +- ansi2/src/snapshots/ansi2__test__plain-2.snap | 160 + ansi2/src/snapshots/ansi2__test__plain-3.snap | 40 + ansi2/src/snapshots/ansi2__test__plain.snap | 48 +- ansi2/src/snapshots/ansi2__test__reset.snap | 20 +- ansi2/src/snapshots/ansi2__test__sgr4-2.snap | 120 + ansi2/src/snapshots/ansi2__test__sgr4-3.snap | 40 + ansi2/src/snapshots/ansi2__test__sgr4.snap | 60 +- ansi2/src/snapshots/ansi2__test__sgr6.snap | 18 +- .../ansi2__test__starship_prompt-2.snap | 600 ++++ .../ansi2__test__starship_prompt-3.snap | 320 ++ .../ansi2__test__starship_prompt.snap | 402 ++- .../ansi2__test__starship_title.snap | 76 +- ansi2/src/snapshots/ansi2__test__style-2.snap | 1120 +++++++ ansi2/src/snapshots/ansi2__test__style-3.snap | 280 ++ ansi2/src/snapshots/ansi2__test__style.snap | 400 ++- ansi2/src/snapshots/ansi2__test__svg2-2.snap | 600 ++++ ansi2/src/snapshots/ansi2__test__svg2-3.snap | 80 + ansi2/src/snapshots/ansi2__test__svg2.snap | 236 +- ansi2/src/snapshots/ansi2__test__test.snap | 34 +- .../src/snapshots/ansi2__test__vitest-2.snap | 600 ++++ .../src/snapshots/ansi2__test__vitest-3.snap | 120 + ansi2/src/snapshots/ansi2__test__vitest.snap | 260 +- .../ansi2__test__vitest_bench-2.snap | 600 ++++ .../ansi2__test__vitest_bench-3.snap | 120 + .../snapshots/ansi2__test__vitest_bench.snap | 260 +- ansi2/src/svg.rs | 17 +- ansi2/src/text.rs | 2 +- assets/changelog/0.2.12.md | 4 + readme.md | 13 + 74 files changed, 19308 insertions(+), 2546 deletions(-) create mode 100644 ansi2/src/canvas.rs create mode 100644 ansi2/src/node.rs delete mode 100644 ansi2/src/snapshots/ansi2__test__link_ll-2.snap.new delete mode 100644 ansi2/src/snapshots/ansi2__test__link_no_close-2.snap.new delete mode 100644 ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap.new diff --git a/ansi2-wasm/src/lib.rs b/ansi2-wasm/src/lib.rs index 1451d1a..69424c6 100644 --- a/ansi2-wasm/src/lib.rs +++ b/ansi2-wasm/src/lib.rs @@ -13,6 +13,7 @@ pub fn to_svg( dark_bg: Option, font_size: Option, length_adjust: Option, + sourcemap: Option, ) -> String { let mode = mode.map(|m| match m { Mode::Dark => ansi2::css::Mode::Dark, @@ -28,6 +29,7 @@ pub fn to_svg( dark_bg, font_size, length_adjust, + sourcemap.unwrap_or(false), ) } @@ -42,6 +44,7 @@ pub fn to_html( light_bg: Option, dark_bg: Option, font_size: Option, + sourcemap: Option, ) -> String { let mode = mode.map(|m| match m { Mode::Dark => ansi2::css::Mode::Dark, @@ -56,6 +59,7 @@ pub fn to_html( light_bg, dark_bg, font_size, + sourcemap.unwrap_or(false), ) } diff --git a/ansi2/Cargo.toml b/ansi2/Cargo.toml index b23e5e1..ef3c143 100644 --- a/ansi2/Cargo.toml +++ b/ansi2/Cargo.toml @@ -26,3 +26,6 @@ minify = ["osvg"] [[bin]] required-features = ["cli"] name = "ansi2" + +[lints.rust] +unused_assignments = "allow" \ No newline at end of file diff --git a/ansi2/src/ans.rs b/ansi2/src/ans.rs index 6b6a826..656a36e 100644 --- a/ansi2/src/ans.rs +++ b/ansi2/src/ans.rs @@ -1,6 +1,6 @@ use std::collections::BinaryHeap; -use crate::{color::AnsiColor, Canvas, Node}; +use crate::{canvas::Canvas, color::AnsiColor, node::Node}; #[derive(Debug, Clone, PartialEq, Eq)] struct Item { state: Node, @@ -278,8 +278,9 @@ mod test { use crate::{ ans::{bfs, to_ans}, + canvas::Canvas, color::AnsiColor, - Canvas, Node, + node::Node, }; use super::min_distance; diff --git a/ansi2/src/canvas.rs b/ansi2/src/canvas.rs new file mode 100644 index 0000000..40b8ef9 --- /dev/null +++ b/ansi2/src/canvas.rs @@ -0,0 +1,452 @@ +use std::collections::VecDeque; + +use crate::{ + color::{AnsiColor, Color8}, + lex::{parse_ansi, Sgr, Token}, + node::Node, +}; + +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct Canvas { + pub pixels: Vec>, + pub w: usize, + pub h: usize, +} + +fn set_node(v: &mut Vec>, node: Node, x: usize, y: usize) { + ensure_height(v, y); + + let row = &mut v[y]; + while x >= row.len() { + let empty = Node { + bg_color: AnsiColor::Default, + color: AnsiColor::Default, + bold: false, + text: ' '.into(), + blink: false, + dim: false, + italic: false, + underline: false, + hide: false, + strike: false, + + bg_color_r: (0, 0), + color_r: (0, 0), + bold_r: (0, 0), + blink_r: (0, 0), + text_r: (0, 0), + dim_r: (0, 0), + italic_r: (0, 0), + underline_r: (0, 0), + hide_r: (0, 0), + strike_r: (0, 0), + }; + row.push(empty); + } + + row[x] = node; +} + +fn ensure_height(v: &mut Vec>, h: usize) { + while v.len() <= h { + v.push(Vec::new()); + } +} + +fn merge_range(a: (usize, usize), b: (usize, usize)) -> (usize, usize) { + let (a1, a2) = a; + let (b1, b2) = b; + + (a1.min(b1), a2.max(b2)) +} + +fn offset_range(range: (usize, usize), offset: (usize, usize)) -> (usize, usize) { + let (a1, _) = range; + let (b1, b2) = offset; + + (a1 + b1, a1 + b2) +} +impl Canvas { + pub fn new>(str: S, max_width: Option) -> Self { + let s = str.as_ref(); + let (_, lex) = parse_ansi(s).unwrap(); + let mut cur_x = 0; + let mut cur_y = 0; + let mut cur_c = AnsiColor::Default; + let mut cur_bg_c = AnsiColor::Default; + let mut bold = false; + let mut dim = false; + let mut italic = false; + let mut reverse = false; + let mut underline = false; + let mut blink = false; + let mut strike = false; + + let mut bg_color_r = (0, 0); + let mut color_r = (0, 0); + let mut bold_r = (0, 0); + let mut blink_r = (0, 0); + let mut text_r = (0, 0); + let mut dim_r = (0, 0); + let mut italic_r = (0, 0); + let mut underline_r = (0, 0); + let mut hide_r = (0, 0); + let mut strike_r = (0, 0); + + let mut w = 0; + let mut h = 0; + let mut pixels = Vec::new(); + let mut hide = false; + let max_width = max_width.unwrap_or(usize::MAX); + + let mut q = VecDeque::from(lex); + + while let Some(token) = q.pop_front() { + let Token { sgr: i, range } = token; + // eprintln!("{:?} {:?}", i, range); + + macro_rules! set_bg_color { + ($color:expr) => { + if reverse && $color == AnsiColor::Default { + cur_bg_c = AnsiColor::Color8(Color8::Black); + } else { + cur_bg_c = $color; + } + + bg_color_r = range; + }; + } + + macro_rules! set_color { + ($color:expr) => { + if reverse && $color == AnsiColor::Default { + cur_c = AnsiColor::Color8(Color8::White); + } else { + cur_c = $color; + } + color_r = range; + }; + } + + match i { + Sgr::LineFeed => { + cur_y += 1; + cur_x = 0; + ensure_height(&mut pixels, cur_y); + } + + Sgr::Char(c) => { + text_r = range; + let node = Node { + text: c.into(), + bg_color: cur_bg_c, + color: cur_c, + bold, + blink, + dim, + italic, + underline, + hide, + strike, + + bg_color_r, + color_r, + bold_r, + blink_r, + text_r, + dim_r, + italic_r, + underline_r, + hide_r, + strike_r, + }; + if cur_x >= max_width { + cur_x = 0; + cur_y += 1; + } + set_node(&mut pixels, node, cur_x, cur_y); + cur_x += 1; + } + Sgr::ColorBackground(c) => { + if reverse { + set_color!(c); + } else { + set_bg_color!(c); + } + } + Sgr::ColorForeground(c) => { + if reverse { + set_bg_color!(c); + } else { + set_color!(c); + } + } + Sgr::ColorFgBg(fg, bg) => { + if reverse { + set_color!(bg); + set_bg_color!(fg); + } else { + set_color!(fg); + set_bg_color!(bg); + } + } + Sgr::Bold => { + bold = true; + bold_r = range; + } + Sgr::Italic => { + italic = true; + italic_r = range; + } + Sgr::UnItalic => { + italic = false; + italic_r = range; + } + Sgr::Underline => { + underline = true; + underline_r = range; + } + Sgr::UnUnderlined => { + underline = false; + underline_r = range; + } + Sgr::Dim => { + dim = true; + dim_r = range; + } + Sgr::ColorReset => { + bold = false; + dim = false; + italic = false; + underline = false; + reverse = false; + cur_bg_c = AnsiColor::Default; + cur_c = AnsiColor::Default; + blink = false; + hide = false; + strike = false; + + bold_r = range; + dim_r = range; + italic_r = range; + underline_r = range; + bg_color_r = range; + color_r = range; + blink_r = range; + hide_r = range; + strike_r = range; + } + Sgr::CursorUp(c) => cur_y = cur_y.saturating_sub(c as usize), + Sgr::CursorDown(c) => { + cur_y += c as usize; + ensure_height(&mut pixels, cur_y); + } + Sgr::CursorBack(c) => cur_x = cur_x.saturating_sub(c as usize), + Sgr::CursorForward(c) => { + cur_x += c as usize; + if cur_x >= max_width { + cur_x %= max_width; + cur_y += 1; + } + ensure_height(&mut pixels, cur_y); + } + Sgr::Backspace => cur_x = cur_x.saturating_sub(1), + Sgr::Tab => { + let tail = cur_x & 7; + if tail == 0 { + cur_x += 8 + } else { + cur_x += 8 - tail; + } + + if cur_x >= max_width { + cur_x %= max_width; + cur_y += 1; + } + ensure_height(&mut pixels, cur_y); + } + + Sgr::CarriageReturn => cur_x = 0, + + Sgr::CursorNextLine(n) => { + cur_y += n as usize; + cur_x = 0; + ensure_height(&mut pixels, cur_y); + } + Sgr::CursorPreviousLine(n) => { + cur_y = cur_y.saturating_sub(n as usize); + cur_x = 0; + ensure_height(&mut pixels, cur_y); + } + Sgr::CursorHorizontalAbsolute(n) => cur_x = (n - 1).max(0) as usize, + Sgr::CursorPosition(x, y) => { + cur_x = x as usize; + cur_y = y as usize; + ensure_height(&mut pixels, cur_y); + } + Sgr::SlowBlink | Sgr::RapidBlink => blink = true, + Sgr::UnBlink => blink = false, + Sgr::Reverse => { + reverse = true; + let tmp_c = cur_c; + let tmp_bg_c = cur_bg_c; + set_color!(tmp_bg_c); + set_bg_color!(tmp_c); + } + Sgr::NormalIntensity => { + dim = false; + bold = false; + + dim_r = range; + bold_r = range; + } + Sgr::UnReversed => { + reverse = false; + set_bg_color!(AnsiColor::Default); + set_color!(AnsiColor::Default); + } + Sgr::Strike => { + strike = true; + strike_r = range; + } + Sgr::UnStrike => { + strike = false; + strike_r = range; + } + Sgr::ColorDefaultForeground => { + if reverse { + set_bg_color!(AnsiColor::Default); + } else { + set_color!(AnsiColor::Default); + } + } + Sgr::ColorDefaultBackground => { + if reverse { + set_color!(AnsiColor::Default); + } else { + set_bg_color!(AnsiColor::Default); + } + } + + Sgr::Link(_, title) => { + if title.contains("\x1b") { + if let Ok((_, tokens)) = parse_ansi(&title) { + // FIXME: Avoid the influence of styles in link on subsequent characters + q.push_front(Token { + range, + sgr: Sgr::ColorReset, + }); + for mut i in tokens.into_iter().rev() { + i.range = offset_range(i.range, range); + q.push_front(i); + } + q.push_front(Token { + range, + sgr: Sgr::Underline, + }); + } + } else { + for (k, i) in title.chars().enumerate() { + if i == '\n' { + cur_x = 0; + cur_y += 1; + ensure_height(&mut pixels, cur_y); + continue; + } + + let node = Node { + text: i.into(), + bg_color: cur_bg_c, + color: cur_c, + bold, + blink, + dim, + italic, + underline: true, + hide, + strike, + + bg_color_r, + color_r, + bold_r, + blink_r, + text_r: (range.0 + k, range.1 + k), + dim_r, + italic_r, + underline_r, + hide_r, + strike_r, + }; + + if cur_x >= max_width { + cur_x = 0; + cur_y += 1; + } + set_node(&mut pixels, node, cur_x, cur_y); + cur_x += 1; + } + } + } + Sgr::CursorHide => { + hide = true; + hide_r = range; + } + Sgr::UnHide => { + hide = false; + hide_r = range; + } + Sgr::DoublyUnderlined => { + bold = false; + underline = true; + + bold_r = range; + underline_r = range; + } + Sgr::List(v) => { + for i in v.into_iter().rev() { + q.push_front(Token { + range: (0, 0), + sgr: i, + }); + } + } + _ => {} + } + + w = w.max(cur_x + 1); + h = h.max(cur_y + 1); + } + + Canvas { pixels, w, h } + } + + pub fn minify(&self) -> Vec> { + let mut v = vec![]; + for row in &self.pixels { + let row_len = row.len(); + + if row_len == 0 { + v.push(vec![]); + continue; + } + + let mut block = row[0].clone(); + + let mut list = vec![]; + for c in row.iter().take(row_len).skip(1) { + if c.same_style(&block) { + block.text.push_str(&c.text); + block.text_r = merge_range(block.text_r, c.text_r); + } else { + list.push(block.clone()); + block = c.clone(); + } + } + + list.push(block); + v.push(list); + } + + v + } +} diff --git a/ansi2/src/css.rs b/ansi2/src/css.rs index 92d4c35..c555073 100644 --- a/ansi2/src/css.rs +++ b/ansi2/src/css.rs @@ -74,6 +74,7 @@ impl Style { self.bg_colors.push(c); } } + #[allow(clippy::too_many_arguments)] pub fn to_css( &self, theme: T, diff --git a/ansi2/src/html.rs b/ansi2/src/html.rs index 076eee4..4febe4f 100644 --- a/ansi2/src/html.rs +++ b/ansi2/src/html.rs @@ -1,7 +1,7 @@ use crate::{ + canvas::Canvas, css::{CssType, Mode, NodeStyle, Style}, theme::ColorTable, - Canvas, }; #[allow(clippy::too_many_arguments)] @@ -14,6 +14,7 @@ pub fn to_html>( light_bg: Option, dark_bg: Option, font_size: Option, + sourcemap: bool, ) -> String { let font_size = font_size.unwrap_or(16); let s = str.as_ref(); @@ -82,6 +83,19 @@ pub fn to_html>( style.add_bg_color(c.bg_color); } + if sourcemap { + text_class.push(format!("text:{}:{}", c.text_r.0, c.text_r.1)); + text_class.push(format!("color:{}:{}", c.color_r.0, c.color_r.1)); + text_class.push(format!("bg:{}:{}", c.bg_color_r.0, c.bg_color_r.1)); + text_class.push(format!("bold:{}:{}", c.bold_r.0, c.bold_r.1)); + text_class.push(format!("blink:{}:{}", c.blink_r.0, c.blink_r.1)); + text_class.push(format!("dim:{}:{}", c.dim_r.0, c.dim_r.1)); + text_class.push(format!("italic:{}:{}", c.italic_r.0, c.italic_r.1)); + text_class.push(format!("underline:{}:{}", c.underline_r.0, c.underline_r.1)); + text_class.push(format!("hide:{}:{}", c.hide_r.0, c.hide_r.1)); + text_class.push(format!("strike:{}:{}", c.strike_r.0, c.strike_r.1)); + } + let text_class = text_class.join(" ").trim().to_string(); let html_char = c.text.to_string(); let html_char = html_escape::encode_text(&html_char); diff --git a/ansi2/src/lex.rs b/ansi2/src/lex.rs index 16faa70..4fd3fcd 100644 --- a/ansi2/src/lex.rs +++ b/ansi2/src/lex.rs @@ -8,7 +8,7 @@ use nom::sequence::tuple; use nom::IResult; #[derive(Debug, Clone)] -pub enum Token { +pub enum Sgr { Char(char), Bell, @@ -67,7 +67,7 @@ pub enum Token { UnUnderlined, UnBlink, - List(Vec), + List(Vec), // url, title Link(String, String), @@ -79,51 +79,96 @@ pub enum Token { Unknown(u8), } -fn get_token_color(n: u8) -> Token { +#[derive(Debug, Clone)] +pub struct Token { + pub sgr: Sgr, + pub range: (usize, usize), +} + +fn get_sgr_color(n: u8) -> Sgr { match n { - 39 => Token::ColorDefaultForeground, - 49 => Token::ColorDefaultBackground, - 30..=37 | 90..=97 => Token::ColorForeground(AnsiColor::from_u8(n)), - 40..=47 | 100..=107 => Token::ColorBackground(AnsiColor::from_u8(n)), - _ => Token::Unknown(0), + 39 => Sgr::ColorDefaultForeground, + 49 => Sgr::ColorDefaultBackground, + 30..=37 | 90..=97 => Sgr::ColorForeground(AnsiColor::from_u8(n)), + 40..=47 | 100..=107 => Sgr::ColorBackground(AnsiColor::from_u8(n)), + _ => Sgr::Unknown(0), } } fn parse_cursor_up(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("a")))(input)?; - Ok((rem, Token::CursorUp(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorUp(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_down(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("b")))(input)?; - Ok((rem, Token::CursorDown(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorDown(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_forward(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("c")))(input)?; - Ok((rem, Token::CursorForward(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorForward(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_back(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("d")))(input)?; - Ok((rem, Token::CursorBack(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorBack(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_next_line(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("e")))(input)?; - Ok((rem, Token::CursorNextLine(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorNextLine(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_previous_line(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("f")))(input)?; - Ok((rem, Token::CursorPreviousLine(str::parse(b).unwrap_or(1)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorPreviousLine(str::parse(b).unwrap_or(1)), + }, + )) } fn parse_cursor_horizontal(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("g")))(input)?; Ok(( rem, - Token::CursorHorizontalAbsolute(str::parse(b).unwrap_or(1)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorHorizontalAbsolute(str::parse(b).unwrap_or(1)), + }, )) } @@ -132,27 +177,54 @@ fn parse_cursor_position(input: &str) -> IResult<&str, Token> { tuple((tag("\x1b["), digit0, tag(":"), digit0, tag_no_case("h")))(input)?; Ok(( rem, - Token::CursorPosition(str::parse(x).unwrap_or(0), str::parse(y).unwrap_or(0)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorPosition(str::parse(x).unwrap_or(0), str::parse(y).unwrap_or(0)), + }, )) } fn parse_erase_in_display(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("j")))(input)?; - Ok((rem, Token::EraseInDisplay(str::parse(b).unwrap_or(0)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::EraseInDisplay(str::parse(b).unwrap_or(0)), + }, + )) } fn parse_erase_in_line(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("k")))(input)?; - Ok((rem, Token::EraseInLine(str::parse(b).unwrap_or(0)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::EraseInLine(str::parse(b).unwrap_or(0)), + }, + )) } fn parse_scroll_up(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("s")))(input)?; - Ok((rem, Token::ScrollUp(str::parse(b).unwrap_or(0)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ScrollUp(str::parse(b).unwrap_or(0)), + }, + )) } fn parse_scroll_down(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b["), digit0, tag_no_case("t")))(input)?; - Ok((rem, Token::ScrollDown(str::parse(b).unwrap_or(0)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ScrollDown(str::parse(b).unwrap_or(0)), + }, + )) } fn parse_horizontal_vertical_position(input: &str) -> IResult<&str, Token> { @@ -160,45 +232,99 @@ fn parse_horizontal_vertical_position(input: &str) -> IResult<&str, Token> { tuple((tag("\x1b["), digit0, tag(":"), digit0, tag_no_case("f")))(input)?; Ok(( rem, - Token::HorizontalVerticalPosition(str::parse(x).unwrap_or(0), str::parse(y).unwrap_or(0)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::HorizontalVerticalPosition( + str::parse(x).unwrap_or(0), + str::parse(y).unwrap_or(0), + ), + }, )) } fn parse_aux_port_on(input: &str) -> IResult<&str, Token> { let (rem, _) = tag("\x1b5i")(input)?; - Ok((rem, Token::AUXPortOn)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::AUXPortOn, + }, + )) } fn parse_aux_port_off(input: &str) -> IResult<&str, Token> { let (rem, _) = tag("\x1b[4i")(input)?; - Ok((rem, Token::AUXPortOff)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::AUXPortOff, + }, + )) } fn parse_device_status_report(input: &str) -> IResult<&str, Token> { let (rem, _) = tag("\x1b[6n")(input)?; - Ok((rem, Token::DeviceStatusReport)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::DeviceStatusReport, + }, + )) } fn parse_cursor_hide(input: &str) -> IResult<&str, Token> { let (rem, _) = tuple((tag("\x1b["), opt(tag("?")), digit0, tag_no_case("l")))(input)?; - Ok((rem, Token::CursorHide)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorHide, + }, + )) } fn parse_cursor_hide_windows(input: &str) -> IResult<&str, Token> { let (rem, _) = tag("\x1b[?2004h")(input)?; - Ok((rem, Token::CursorHide)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorHide, + }, + )) } fn parse_title(input: &str) -> IResult<&str, Token> { let (rem, (_, s, _)) = tuple((tag("\x1b]0;"), take_until("\x07"), tag("\x07")))(input)?; - Ok((rem, Token::Title(s.into()))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Title(s.into()), + }, + )) } fn parse_bold(input: &str) -> IResult<&str, Token> { let (rem, _) = tag("\x1b(B")(input)?; - Ok((rem, Token::Bold)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Bold, + }, + )) } fn parse_cursor_show(input: &str) -> IResult<&str, Token> { let (rem, _) = tuple((tag("\x1b["), opt(tag("?")), digit0, tag_no_case("h")))(input)?; - Ok((rem, Token::CursorShow)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CursorShow, + }, + )) } fn parse_color_foreground(input: &str) -> IResult<&str, Token> { @@ -209,9 +335,23 @@ fn parse_color_foreground(input: &str) -> IResult<&str, Token> { let c = match b { 0..=7 => b + 30, 8..=15 => b + 82, - _ => return Ok((rem, Token::ColorForeground(AnsiColor::Color256(b)))), + _ => { + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorForeground(AnsiColor::Color256(b)), + }, + )) + } }; - Ok((rem, Token::ColorForeground(AnsiColor::from_u8(c)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorForeground(AnsiColor::from_u8(c)), + }, + )) } fn parse_color_background(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b[48;5;"), digit0, tag_no_case("m")))(input)?; @@ -220,49 +360,66 @@ fn parse_color_background(input: &str) -> IResult<&str, Token> { let c = match b { 0..=7 => b + 40, 8..=15 => b + 92, - _ => return Ok((rem, Token::ColorBackground(AnsiColor::Color256(b)))), + _ => { + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorBackground(AnsiColor::Color256(b)), + }, + )) + } }; - Ok((rem, Token::ColorBackground(AnsiColor::from_u8(c)))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorBackground(AnsiColor::from_u8(c)), + }, + )) } fn parse_color_underline(input: &str) -> IResult<&str, Token> { let (rem, (_, b, _)) = tuple((tag("\x1b[58;5;"), digit0, tag_no_case("m")))(input)?; Ok(( rem, - Token::ColorUnderLine(AnsiColor::from_u8(str::parse(b).unwrap_or(1))), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorUnderLine(AnsiColor::from_u8(str::parse(b).unwrap_or(1))), + }, )) } -pub fn get_sgr(n: u8) -> Token { +pub fn get_sgr(n: u8) -> Sgr { match n { - 0 => Token::ColorReset, - 1 => Token::Bold, - 2 => Token::Dim, - 3 => Token::Italic, - 4 => Token::Underline, - 5 => Token::SlowBlink, - 6 => Token::RapidBlink, - 7 => Token::Reverse, - 8 => Token::CursorHide, - 9 => Token::Strike, - 10 => Token::PrimaryFont, - 11..=19 => Token::AlternativeFont(n - 10), - 20 => Token::Fraktur, - 21 => Token::DoublyUnderlined, - 24 => Token::UnUnderlined, - 25 => Token::UnBlink, - 30..=37 | 90..=97 => Token::ColorForeground(AnsiColor::from_u8(n)), - 40..=47 | 100..=107 => Token::ColorBackground(AnsiColor::from_u8(n)), - 39 => Token::ColorDefaultForeground, - 49 => Token::ColorDefaultBackground, - 59 => Token::ColorDefaultUnderline, - 22 => Token::NormalIntensity, - 27 => Token::UnReversed, - 29 => Token::UnStrike, - 28 => Token::UnHide, - 23 => Token::UnItalic, - - _ => Token::Unknown(n), + 0 => Sgr::ColorReset, + 1 => Sgr::Bold, + 2 => Sgr::Dim, + 3 => Sgr::Italic, + 4 => Sgr::Underline, + 5 => Sgr::SlowBlink, + 6 => Sgr::RapidBlink, + 7 => Sgr::Reverse, + 8 => Sgr::CursorHide, + 9 => Sgr::Strike, + 10 => Sgr::PrimaryFont, + 11..=19 => Sgr::AlternativeFont(n - 10), + 20 => Sgr::Fraktur, + 21 => Sgr::DoublyUnderlined, + 24 => Sgr::UnUnderlined, + 25 => Sgr::UnBlink, + 30..=37 | 90..=97 => Sgr::ColorForeground(AnsiColor::from_u8(n)), + 40..=47 | 100..=107 => Sgr::ColorBackground(AnsiColor::from_u8(n)), + 39 => Sgr::ColorDefaultForeground, + 49 => Sgr::ColorDefaultBackground, + 59 => Sgr::ColorDefaultUnderline, + 22 => Sgr::NormalIntensity, + 27 => Sgr::UnReversed, + 29 => Sgr::UnStrike, + 28 => Sgr::UnHide, + 23 => Sgr::UnItalic, + + _ => Sgr::Unknown(n), } } @@ -271,47 +428,101 @@ fn parse_sgr1(input: &str) -> IResult<&str, Token> { let n: u8 = str::parse(b).unwrap_or_default(); - Ok((rem, get_sgr(n))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: get_sgr(n), + }, + )) } fn parse_color_reset(input: &str) -> IResult<&str, Token> { let (rem, _) = tuple((tag("\x1b[0"), tag_no_case("m")))(input)?; - Ok((rem, Token::ColorReset)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorReset, + }, + )) } fn parse_anychar(input: &str) -> IResult<&str, Token> { let (rem, c) = anychar(input)?; - Ok((rem, Token::Char(c))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Char(c), + }, + )) } fn parse_bell(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x07')(input)?; - Ok((rem, Token::Bell)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Bell, + }, + )) } fn parse_backspace(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x08')(input)?; - Ok((rem, Token::Backspace)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Backspace, + }, + )) } fn parse_tab(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x09')(input)?; - Ok((rem, Token::Bell)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Bell, + }, + )) } fn parse_line_feed(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x0A')(input)?; - Ok((rem, Token::LineFeed)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::LineFeed, + }, + )) } fn parse_form_feed(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x0C')(input)?; - Ok((rem, Token::FormFeed)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::FormFeed, + }, + )) } fn parse_carriage_return(input: &str) -> IResult<&str, Token> { let (rem, _) = nom::character::complete::char('\x0D')(input)?; - Ok((rem, Token::CarriageReturn)) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::CarriageReturn, + }, + )) } fn parse_sgr2(input: &str) -> IResult<&str, Token> { @@ -320,7 +531,13 @@ fn parse_sgr2(input: &str) -> IResult<&str, Token> { let a = front.parse().unwrap_or(0); let b = background.parse().unwrap_or(0); - Ok((rem, Token::List(vec![get_sgr(a), get_token_color(b)]))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::List(vec![get_sgr(a), get_sgr_color(b)]), + }, + )) } fn parse_sgr3(input: &str) -> IResult<&str, Token> { @@ -339,14 +556,29 @@ fn parse_sgr3(input: &str) -> IResult<&str, Token> { let c = background.parse().unwrap_or(0); if a == 38 && b == 5 { - return Ok((rem, Token::ColorForeground(AnsiColor::from_u8(c)))); + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorForeground(AnsiColor::from_u8(c)), + }, + )); } if a == 48 && b == 5 { - return Ok((rem, Token::ColorBackground(AnsiColor::from_u8(c)))); + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorBackground(AnsiColor::from_u8(c)), + }, + )); } Ok(( rem, - Token::List(vec![get_sgr(a), get_token_color(b), get_token_color(c)]), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::List(vec![get_sgr(a), get_sgr_color(b), get_sgr_color(c)]), + }, )) } @@ -372,33 +604,39 @@ fn parse_sgr4(input: &str) -> IResult<&str, Token> { match b { 48 => match c { 5 => { - v.push(Token::ColorBackground(AnsiColor::Color256(d))); + v.push(Sgr::ColorBackground(AnsiColor::Color256(d))); } _ => { - v.push(Token::ColorBackground(AnsiColor::from_u8(d))); + v.push(Sgr::ColorBackground(AnsiColor::from_u8(d))); } }, 38 => match c { 5 => { - v.push(Token::ColorForeground(AnsiColor::Color256(d))); + v.push(Sgr::ColorForeground(AnsiColor::Color256(d))); } _ => { - v.push(Token::ColorForeground(AnsiColor::from_u8(d))); + v.push(Sgr::ColorForeground(AnsiColor::from_u8(d))); } }, 5 | 6 => { v.push(get_sgr(b)); - v.push(Token::ColorForeground(AnsiColor::from_u8(c))); - v.push(Token::ColorBackground(AnsiColor::from_u8(d))); + v.push(Sgr::ColorForeground(AnsiColor::from_u8(c))); + v.push(Sgr::ColorBackground(AnsiColor::from_u8(d))); } _ => { v.push(get_sgr(b)); - v.push(Token::ColorForeground(AnsiColor::Color256(c))); - v.push(Token::ColorBackground(AnsiColor::Color256(d))); + v.push(Sgr::ColorForeground(AnsiColor::Color256(c))); + v.push(Sgr::ColorBackground(AnsiColor::Color256(d))); } }; - Ok((rem, Token::List(v))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::List(v), + }, + )) } fn parse_sgr5(input: &str) -> IResult<&str, Token> { @@ -421,11 +659,23 @@ fn parse_sgr5(input: &str) -> IResult<&str, Token> { let g = g.parse().unwrap_or(0); let b = b.parse().unwrap_or(0); if ctrl == 38 && ty == 2 { - return Ok((rem, Token::ColorForeground(AnsiColor::Rgb(r, g, b)))); + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorForeground(AnsiColor::Rgb(r, g, b)), + }, + )); } if ctrl == 48 && ty == 2 { - return Ok((rem, Token::ColorBackground(AnsiColor::Rgb(r, g, b)))); + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorBackground(AnsiColor::Rgb(r, g, b)), + }, + )); } todo!() } @@ -455,27 +705,39 @@ fn parse_sgr6(input: &str) -> IResult<&str, Token> { if ctrl == 38 && ty == 2 { return Ok(( rem, - Token::ColorFgBg(AnsiColor::Rgb(r, g, b), AnsiColor::from_u8(n)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorFgBg(AnsiColor::Rgb(r, g, b), AnsiColor::from_u8(n)), + }, )); } if ctrl == 48 && ty == 2 { return Ok(( rem, - Token::ColorFgBg(AnsiColor::from_u8(n), AnsiColor::Rgb(r, g, b)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorFgBg(AnsiColor::from_u8(n), AnsiColor::Rgb(r, g, b)), + }, )); } if ctrl == 48 && ty == 5 && g == 38 && b == 5 { return Ok(( rem, - Token::ColorFgBg(AnsiColor::Color256(n), AnsiColor::Color256(r)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorFgBg(AnsiColor::Color256(n), AnsiColor::Color256(r)), + }, )); } if ctrl == 38 && ty == 5 && g == 48 && b == 5 { return Ok(( rem, - Token::ColorFgBg(AnsiColor::Color256(r), AnsiColor::Color256(n)), + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorFgBg(AnsiColor::Color256(r), AnsiColor::Color256(n)), + }, )); } todo!() @@ -511,23 +773,19 @@ fn parse_sgr7(input: &str) -> IResult<&str, Token> { match a { 38 => match b { 5 => { - v.push(Token::ColorForeground(AnsiColor::Color256(c))); + v.push(Sgr::ColorForeground(AnsiColor::Color256(c))); } 2 => { - v.push(Token::ColorForeground(AnsiColor::Color8(Color8::from_u8( - c, - )))); + v.push(Sgr::ColorForeground(AnsiColor::Color8(Color8::from_u8(c)))); } _ => {} }, 48 => match b { 5 => { - v.push(Token::ColorBackground(AnsiColor::Color256(c))); + v.push(Sgr::ColorBackground(AnsiColor::Color256(c))); } 2 => { - v.push(Token::ColorBackground(AnsiColor::Color8(Color8::from_u8( - c, - )))); + v.push(Sgr::ColorBackground(AnsiColor::Color8(Color8::from_u8(c)))); } _ => {} }, @@ -537,30 +795,32 @@ fn parse_sgr7(input: &str) -> IResult<&str, Token> { match d { 38 => match e { 5 => { - v.push(Token::ColorForeground(AnsiColor::Color256(f))); + v.push(Sgr::ColorForeground(AnsiColor::Color256(f))); } 2 => { - v.push(Token::ColorForeground(AnsiColor::Color8(Color8::from_u8( - f, - )))); + v.push(Sgr::ColorForeground(AnsiColor::Color8(Color8::from_u8(f)))); } _ => {} }, 48 => match e { 5 => { - v.push(Token::ColorBackground(AnsiColor::Color256(f))); + v.push(Sgr::ColorBackground(AnsiColor::Color256(f))); } 2 => { - v.push(Token::ColorBackground(AnsiColor::Color8(Color8::from_u8( - f, - )))); + v.push(Sgr::ColorBackground(AnsiColor::Color8(Color8::from_u8(f)))); } _ => {} }, _ => {} } - Ok((rem, Token::List(v))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::List(v), + }, + )) } fn parse_sgr10(input: &str) -> IResult<&str, Token> { @@ -613,7 +873,13 @@ fn parse_sgr10(input: &str) -> IResult<&str, Token> { if c2 == 48 && t2 == 2 { bg = AnsiColor::Rgb(r2, g2, b2) } - Ok((rem, Token::ColorFgBg(fg, bg))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::ColorFgBg(fg, bg), + }, + )) } fn parse_unknown(input: &str) -> IResult<&str, Token> { let (rem, n) = alt(( @@ -639,10 +905,22 @@ fn parse_unknown(input: &str) -> IResult<&str, Token> { ))(input)?; if n == '\x1a' { - return Ok((rem, Token::Char('␦'))); + return Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Char('␦'), + }, + )); } - Ok((rem, Token::Unknown(n as u8))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Unknown(n as u8), + }, + )) } fn parse_link_no_title(input: &str) -> IResult<&str, Token> { @@ -652,7 +930,13 @@ fn parse_link_no_title(input: &str) -> IResult<&str, Token> { alt((take_until("\x1b]8;;\x1b\\"), take_until("\x1b[!p"))), alt((tag("\x1b]8;;\x1b\\"), tag("\x1b[!p"))), ))(input)?; - Ok((rem, Token::Link(url.to_string(), url.to_string()))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Link(url.to_string(), url.to_string()), + }, + )) } fn parse_link_with_title(input: &str) -> IResult<&str, Token> { @@ -664,7 +948,13 @@ fn parse_link_with_title(input: &str) -> IResult<&str, Token> { alt((take_until("\x1b]8;;\x1b\\"), take_until("\x1b[!p"))), alt((tag("\x1b]8;;\x1b\\"), tag("\x1b[!p"))), ))(input)?; - Ok((rem, Token::Link(url.to_string(), title.to_string()))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Link(url.to_string(), title.to_string()), + }, + )) } fn parse_link_ll(input: &str) -> IResult<&str, Token> { @@ -675,11 +965,17 @@ fn parse_link_ll(input: &str) -> IResult<&str, Token> { take_until("\x1b]8;;\x07"), tag("\x1b]8;;\x07"), ))(input)?; - Ok((rem, Token::Link(url.to_string(), title.to_string()))) + Ok(( + rem, + Token { + range: (input.chars().count(), rem.chars().count()), + sgr: Sgr::Link(url.to_string(), title.to_string()), + }, + )) } pub(crate) fn parse_ansi(input: &str) -> IResult<&str, Vec> { - many0(alt(( + let mut v = many0(alt(( alt(( parse_bell, parse_backspace, @@ -730,5 +1026,13 @@ pub(crate) fn parse_ansi(input: &str) -> IResult<&str, Vec> { alt((parse_link_with_title, parse_link_no_title, parse_link_ll)), parse_unknown, parse_anychar, - )))(input) + )))(input)?; + + for i in v.1.iter_mut() { + i.range = ( + input.chars().count() - i.range.0, + input.chars().count() - i.range.1, + ) + } + Ok(v) } diff --git a/ansi2/src/lib.rs b/ansi2/src/lib.rs index 6d46027..a9cc009 100644 --- a/ansi2/src/lib.rs +++ b/ansi2/src/lib.rs @@ -1,389 +1,17 @@ pub mod ans; +pub mod canvas; pub mod color; -#[allow(clippy::too_many_arguments)] pub mod css; pub mod html; pub mod lex; +pub mod node; pub mod svg; pub mod text; pub mod theme; -use color::AnsiColor; -use lex::{parse_ansi, Token}; -use std::{collections::VecDeque, vec}; - -#[derive(Debug, Clone, Default, PartialEq, Eq)] -pub struct Node { - pub bg_color: AnsiColor, - pub color: AnsiColor, - pub bold: bool, - pub blink: bool, - pub text: String, - pub dim: bool, - pub italic: bool, - pub underline: bool, - pub hide: bool, - pub strike: bool, -} - -impl Node { - pub fn same_style(&self, other: &Node) -> bool { - self.bg_color == other.bg_color - && self.color == other.color - && self.bold == other.bold - && self.blink == other.blink - && self.dim == other.dim - && self.italic == other.italic - && self.underline == other.underline - && self.hide == other.hide - && self.strike == other.strike - } -} - -#[derive(Debug, Clone, Default, PartialEq, Eq)] -pub struct Canvas { - pub pixels: Vec>, - pub w: usize, - pub h: usize, -} - -fn set_node(v: &mut Vec>, node: Node, x: usize, y: usize) { - ensure_height(v, y); - - let row = &mut v[y]; - while x >= row.len() { - let empty = Node { - bg_color: AnsiColor::Default, - color: AnsiColor::Default, - bold: false, - text: ' '.into(), - blink: false, - dim: false, - italic: false, - underline: false, - hide: false, - strike: false, - }; - row.push(empty); - } - - row[x] = node; -} - -fn ensure_height(v: &mut Vec>, h: usize) { - while v.len() <= h { - v.push(Vec::new()); - } -} - -impl Canvas { - pub fn new>(str: S, max_width: Option) -> Self { - let s = str.as_ref(); - let (_, lex) = parse_ansi(s).unwrap(); - let mut cur_x = 0; - let mut cur_y = 0; - let mut cur_c = AnsiColor::Default; - let mut cur_bg_c = AnsiColor::Default; - let mut bold = false; - let mut dim = false; - let mut italic = false; - let mut reverse = false; - let mut underline = false; - let mut blink = false; - let mut strike = false; - let mut w = 0; - let mut h = 0; - let mut pixels = Vec::new(); - let mut hide = false; - let max_width = max_width.unwrap_or(usize::MAX); - - let mut q = VecDeque::from(lex); - - macro_rules! set_bg_color { - ($color:expr) => { - if reverse && $color == AnsiColor::Default { - cur_bg_c = AnsiColor::Color8(color::Color8::Black); - } else { - cur_bg_c = $color; - } - }; - } - - macro_rules! set_color { - ($color:expr) => { - if reverse && $color == AnsiColor::Default { - cur_c = AnsiColor::Color8(color::Color8::White); - } else { - cur_c = $color; - } - }; - } - - while let Some(i) = q.pop_front() { - // eprintln!("{:?}", i); - match i { - Token::LineFeed => { - cur_y += 1; - cur_x = 0; - ensure_height(&mut pixels, cur_y); - } - - Token::Char(c) => { - let node = Node { - text: c.into(), - bg_color: cur_bg_c, - color: cur_c, - bold, - blink, - dim, - italic, - underline, - hide, - strike, - }; - if cur_x >= max_width { - cur_x = 0; - cur_y += 1; - } - set_node(&mut pixels, node, cur_x, cur_y); - cur_x += 1; - } - Token::ColorBackground(c) => { - if reverse { - set_color!(c); - } else { - set_bg_color!(c); - } - } - Token::ColorForeground(c) => { - if reverse { - set_bg_color!(c); - } else { - set_color!(c); - } - } - Token::ColorFgBg(fg, bg) => { - if reverse { - set_color!(bg); - set_bg_color!(fg); - } else { - set_color!(fg); - set_bg_color!(bg); - } - } - Token::Bold => bold = true, - Token::Italic => { - italic = true; - } - Token::UnItalic => { - italic = false; - } - Token::Underline => { - underline = true; - } - Token::UnUnderlined => { - underline = false; - } - Token::Dim => { - dim = true; - } - Token::ColorReset => { - bold = false; - dim = false; - italic = false; - underline = false; - reverse = false; - - cur_bg_c = AnsiColor::Default; - cur_c = AnsiColor::Default; - blink = false; - hide = false; - strike = false; - } - Token::CursorUp(c) => cur_y = cur_y.saturating_sub(c as usize), - Token::CursorDown(c) => { - cur_y += c as usize; - ensure_height(&mut pixels, cur_y); - } - Token::CursorBack(c) => cur_x = cur_x.saturating_sub(c as usize), - Token::CursorForward(c) => { - cur_x += c as usize; - if cur_x >= max_width { - cur_x %= max_width; - cur_y += 1; - } - ensure_height(&mut pixels, cur_y); - } - Token::Backspace => cur_x = cur_x.saturating_sub(1), - Token::Tab => { - let tail = cur_x & 7; - if tail == 0 { - cur_x += 8 - } else { - cur_x += 8 - tail; - } - - if cur_x >= max_width { - cur_x %= max_width; - cur_y += 1; - } - ensure_height(&mut pixels, cur_y); - } - - Token::CarriageReturn => cur_x = 0, - - Token::CursorNextLine(n) => { - cur_y += n as usize; - cur_x = 0; - ensure_height(&mut pixels, cur_y); - } - Token::CursorPreviousLine(n) => { - cur_y = cur_y.saturating_sub(n as usize); - cur_x = 0; - ensure_height(&mut pixels, cur_y); - } - Token::CursorHorizontalAbsolute(n) => cur_x = (n - 1).max(0) as usize, - Token::CursorPosition(x, y) => { - cur_x = x as usize; - cur_y = y as usize; - ensure_height(&mut pixels, cur_y); - } - Token::SlowBlink | Token::RapidBlink => blink = true, - Token::UnBlink => blink = false, - Token::Reverse => { - reverse = true; - let tmp_c = cur_c; - let tmp_bg_c = cur_bg_c; - set_color!(tmp_bg_c); - set_bg_color!(tmp_c); - } - Token::NormalIntensity => { - dim = false; - bold = false; - } - Token::UnReversed => { - reverse = false; - set_bg_color!(AnsiColor::Default); - set_color!(AnsiColor::Default); - } - Token::Strike => { - strike = true; - } - Token::UnStrike => { - strike = false; - } - Token::ColorDefaultForeground => { - if reverse { - set_bg_color!(AnsiColor::Default); - } else { - set_color!(AnsiColor::Default); - } - } - Token::ColorDefaultBackground => { - if reverse { - set_color!(AnsiColor::Default); - } else { - set_bg_color!(AnsiColor::Default); - } - } - - Token::Link(_, title) => match parse_ansi(&title) { - Ok((_, tokens)) => { - // FIXME: Avoid the influence of styles in link on subsequent characters - q.push_front(Token::ColorReset); - for i in tokens.into_iter().rev() { - q.push_front(i); - } - q.push_front(Token::Underline); - } - Err(_) => { - for i in title.chars() { - if i == '\n' { - cur_x = 0; - cur_y += 1; - ensure_height(&mut pixels, cur_y); - continue; - } - - let node = Node { - text: i.into(), - bg_color: cur_bg_c, - color: cur_c, - bold, - blink, - dim, - italic, - underline: true, - hide, - strike, - }; - - if cur_x >= max_width { - cur_x = 0; - cur_y += 1; - } - set_node(&mut pixels, node, cur_x, cur_y); - cur_x += 1; - } - } - }, - Token::CursorHide => { - hide = true; - } - Token::UnHide => { - hide = false; - } - Token::DoublyUnderlined => { - bold = false; - underline = true; - } - Token::List(v) => { - for i in v.into_iter().rev() { - q.push_front(i); - } - } - _ => {} - } - - w = w.max(cur_x + 1); - h = h.max(cur_y + 1); - } - - Canvas { pixels, w, h } - } - - pub fn minify(&self) -> Vec> { - let mut v = vec![]; - for row in &self.pixels { - let row_len = row.len(); - - if row_len == 0 { - v.push(vec![]); - continue; - } - - let mut block = row[0].clone(); - - let mut list = vec![]; - for c in row.iter().take(row_len).skip(1) { - if c.same_style(&block) { - block.text.push_str(&c.text); - } else { - list.push(block.clone()); - block = c.clone(); - } - } - - list.push(block); - v.push(list); - } - - v - } -} #[cfg(test)] mod test { - use crate::{lex::parse_ansi, Canvas}; + use crate::{canvas::Canvas, lex::parse_ansi}; use insta::assert_debug_snapshot; #[test] fn test_plain() { diff --git a/ansi2/src/main.rs b/ansi2/src/main.rs index c3716bf..5379eba 100644 --- a/ansi2/src/main.rs +++ b/ansi2/src/main.rs @@ -46,6 +46,9 @@ struct Args { #[arg(long)] length_adjust: Option, + + #[arg(short, long, default_value_t = false)] + sourcemap: bool, } fn main() { @@ -61,6 +64,7 @@ fn main() { dark_bg, font_size, length_adjust, + sourcemap, } = args; let format = format.unwrap_or(Format::Svg); let theme = theme.unwrap_or(Theme::Vscode); @@ -96,6 +100,7 @@ fn main() { dark_bg, font_size, length_adjust, + sourcemap, ); if compress { svg = osvg::osvg( @@ -120,7 +125,9 @@ fn main() { } svg } - Format::Html => to_html(&s, theme, width, base64, mode, light_bg, dark_bg, font_size), + Format::Html => to_html( + &s, theme, width, base64, mode, light_bg, dark_bg, font_size, sourcemap, + ), Format::Text => to_text(&s, width), Format::Ans => to_ans(&s, width, compress), }; diff --git a/ansi2/src/node.rs b/ansi2/src/node.rs new file mode 100644 index 0000000..76e94b1 --- /dev/null +++ b/ansi2/src/node.rs @@ -0,0 +1,59 @@ +use crate::color::AnsiColor; + +#[derive(Debug, Clone, Default)] +pub struct Node { + pub bg_color: AnsiColor, + pub color: AnsiColor, + pub bold: bool, + pub blink: bool, + pub text: String, + pub dim: bool, + pub italic: bool, + pub underline: bool, + pub hide: bool, + pub strike: bool, + + // sourcemap + pub bg_color_r: (usize, usize), + pub color_r: (usize, usize), + pub bold_r: (usize, usize), + pub blink_r: (usize, usize), + pub text_r: (usize, usize), + pub dim_r: (usize, usize), + pub italic_r: (usize, usize), + pub underline_r: (usize, usize), + pub hide_r: (usize, usize), + pub strike_r: (usize, usize), +} + +// ignore sourcemap fields +impl PartialEq for Node { + fn eq(&self, other: &Self) -> bool { + self.bg_color == other.bg_color + && self.color == other.color + && self.bold == other.bold + && self.blink == other.blink + && self.text == other.text + && self.dim == other.dim + && self.italic == other.italic + && self.underline == other.underline + && self.hide == other.hide + && self.strike == other.strike + } +} + +impl Eq for Node {} + +impl Node { + pub fn same_style(&self, other: &Node) -> bool { + self.bg_color == other.bg_color + && self.color == other.color + && self.bold == other.bold + && self.blink == other.blink + && self.dim == other.dim + && self.italic == other.italic + && self.underline == other.underline + && self.hide == other.hide + && self.strike == other.strike + } +} diff --git a/ansi2/src/snapshots/ansi2__test__base-2.snap b/ansi2/src/snapshots/ansi2__test__base-2.snap index 957cda5..1f56684 100644 --- a/ansi2/src/snapshots/ansi2__test__base-2.snap +++ b/ansi2/src/snapshots/ansi2__test__base-2.snap @@ -18,6 +18,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 6, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -32,6 +72,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 6, + 7, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -46,6 +126,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 8, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -60,6 +180,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 9, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -74,6 +234,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -86,6 +286,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 10, + 14, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -98,6 +338,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 10, + 14, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -110,6 +390,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 10, + 14, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -122,6 +442,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 10, + 14, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -136,6 +496,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 23, + 24, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -150,6 +550,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 24, + 25, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -164,6 +604,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 25, + 26, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -178,6 +658,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 26, + 27, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -192,6 +712,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 27, + 28, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -206,6 +766,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 28, + 29, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -220,6 +820,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 29, + 30, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -234,6 +874,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 30, + 31, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -248,6 +928,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 31, + 32, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -262,6 +982,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 32, + 33, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -276,6 +1036,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 33, + 34, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -290,6 +1090,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 34, + 35, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -302,6 +1142,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 39, + 40, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -314,6 +1194,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 40, + 41, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -326,6 +1246,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 41, + 42, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -338,6 +1298,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -350,6 +1350,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 43, + 44, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -364,6 +1404,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 49, + 50, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -378,6 +1458,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 50, + 51, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -392,6 +1512,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 51, + 52, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -406,6 +1566,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 52, + 53, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -420,6 +1620,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 53, + 54, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -432,6 +1672,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 54, + 58, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 58, + 59, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Default, @@ -444,6 +1724,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 54, + 58, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 59, + 60, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Default, @@ -456,6 +1776,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 54, + 58, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 60, + 61, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Default, @@ -468,6 +1828,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 54, + 58, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 61, + 62, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -482,6 +1882,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 68, + 69, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -496,6 +1936,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 69, + 70, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -510,6 +1990,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 70, + 71, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -524,6 +2044,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 71, + 72, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -538,6 +2098,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 72, + 73, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -552,6 +2152,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 73, + 74, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -566,6 +2206,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 74, + 75, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -580,6 +2260,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 75, + 76, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -594,6 +2314,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 76, + 77, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -608,6 +2368,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 77, + 78, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -622,6 +2422,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 78, + 79, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -636,6 +2476,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 79, + 80, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__base-3.snap b/ansi2/src/snapshots/ansi2__test__base-3.snap index 88b0fa5..95c4310 100644 --- a/ansi2/src/snapshots/ansi2__test__base-3.snap +++ b/ansi2/src/snapshots/ansi2__test__base-3.snap @@ -17,6 +17,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 5, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -29,6 +69,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 10, + 14, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 14, + 18, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -43,6 +123,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 10, + 14, + ), + color_r: ( + 18, + 23, + ), + bold_r: ( + 10, + 14, + ), + blink_r: ( + 10, + 14, + ), + text_r: ( + 23, + 35, + ), + dim_r: ( + 10, + 14, + ), + italic_r: ( + 10, + 14, + ), + underline_r: ( + 10, + 14, + ), + hide_r: ( + 10, + 14, + ), + strike_r: ( + 10, + 14, + ), }, Node { bg_color: Default, @@ -55,6 +175,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 35, + 39, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 39, + 44, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Color8( @@ -69,6 +229,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 44, + 49, + ), + color_r: ( + 35, + 39, + ), + bold_r: ( + 35, + 39, + ), + blink_r: ( + 35, + 39, + ), + text_r: ( + 49, + 54, + ), + dim_r: ( + 35, + 39, + ), + italic_r: ( + 35, + 39, + ), + underline_r: ( + 35, + 39, + ), + hide_r: ( + 35, + 39, + ), + strike_r: ( + 35, + 39, + ), }, Node { bg_color: Default, @@ -81,6 +281,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 54, + 58, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 58, + 62, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, Node { bg_color: Color8( @@ -95,6 +335,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 62, + 68, + ), + color_r: ( + 54, + 58, + ), + bold_r: ( + 54, + 58, + ), + blink_r: ( + 54, + 58, + ), + text_r: ( + 68, + 80, + ), + dim_r: ( + 54, + 58, + ), + italic_r: ( + 54, + 58, + ), + underline_r: ( + 54, + 58, + ), + hide_r: ( + 54, + 58, + ), + strike_r: ( + 54, + 58, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__base.snap b/ansi2/src/snapshots/ansi2__test__base.snap index 488cbad..f668160 100644 --- a/ansi2/src/snapshots/ansi2__test__base.snap +++ b/ansi2/src/snapshots/ansi2__test__base.snap @@ -5,170 +5,500 @@ expression: r ( "", [ - ColorForeground( - Color8( - Black, - ), - ), - Char( - 'b', - ), - Char( - 'l', - ), - Char( - 'a', - ), - Char( - 'c', - ), - Char( - 'k', - ), - ColorReset, - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - ColorForeground( - Color8( - BrightBlack, - ), - ), - Char( - 'b', - ), - Char( - 'r', - ), - Char( - 'i', - ), - Char( - 'g', - ), - Char( - 'h', - ), - Char( - 't', - ), - Char( - ' ', - ), - Char( - 'b', - ), - Char( - 'l', - ), - Char( - 'a', - ), - Char( - 'c', - ), - Char( - 'k', - ), - ColorReset, - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - ColorBackground( - Color8( - Black, - ), - ), - Char( - 'b', - ), - Char( - 'l', - ), - Char( - 'a', - ), - Char( - 'c', - ), - Char( - 'k', - ), - ColorReset, - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - Char( - ' ', - ), - ColorBackground( - Color8( - BrightBlack, - ), - ), - Char( - 'b', - ), - Char( - 'r', - ), - Char( - 'i', - ), - Char( - 'g', - ), - Char( - 'h', - ), - Char( - 't', - ), - Char( - ' ', - ), - Char( - 'b', - ), - Char( - 'l', - ), - Char( - 'a', - ), - Char( - 'c', - ), - Char( - 'k', - ), - ColorReset, + Token { + sgr: ColorForeground( + Color8( + Black, + ), + ), + range: ( + 0, + 5, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 5, + 6, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 6, + 7, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 7, + 8, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 8, + 9, + ), + }, + Token { + sgr: Char( + 'k', + ), + range: ( + 9, + 10, + ), + }, + Token { + sgr: ColorReset, + range: ( + 10, + 14, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: ColorForeground( + Color8( + BrightBlack, + ), + ), + range: ( + 18, + 23, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 23, + 24, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 24, + 25, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 25, + 26, + ), + }, + Token { + sgr: Char( + 'g', + ), + range: ( + 26, + 27, + ), + }, + Token { + sgr: Char( + 'h', + ), + range: ( + 27, + 28, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 28, + 29, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 29, + 30, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 30, + 31, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 31, + 32, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 32, + 33, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 33, + 34, + ), + }, + Token { + sgr: Char( + 'k', + ), + range: ( + 34, + 35, + ), + }, + Token { + sgr: ColorReset, + range: ( + 35, + 39, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 39, + 40, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 40, + 41, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 41, + 42, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 43, + 44, + ), + }, + Token { + sgr: ColorBackground( + Color8( + Black, + ), + ), + range: ( + 44, + 49, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 49, + 50, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 50, + 51, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 51, + 52, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 52, + 53, + ), + }, + Token { + sgr: Char( + 'k', + ), + range: ( + 53, + 54, + ), + }, + Token { + sgr: ColorReset, + range: ( + 54, + 58, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 58, + 59, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 59, + 60, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 60, + 61, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 61, + 62, + ), + }, + Token { + sgr: ColorBackground( + Color8( + BrightBlack, + ), + ), + range: ( + 62, + 68, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 68, + 69, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 69, + 70, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 70, + 71, + ), + }, + Token { + sgr: Char( + 'g', + ), + range: ( + 71, + 72, + ), + }, + Token { + sgr: Char( + 'h', + ), + range: ( + 72, + 73, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 73, + 74, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 74, + 75, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 75, + 76, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 76, + 77, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 77, + 78, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 78, + 79, + ), + }, + Token { + sgr: Char( + 'k', + ), + range: ( + 79, + 80, + ), + }, + Token { + sgr: ColorReset, + range: ( + 80, + 84, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__color24.snap b/ansi2/src/snapshots/ansi2__test__color24.snap index a7e0aa0..9cab4cc 100644 --- a/ansi2/src/snapshots/ansi2__test__color24.snap +++ b/ansi2/src/snapshots/ansi2__test__color24.snap @@ -5,12 +5,18 @@ expression: r ( "", [ - ColorForeground( - Rgb( - 0, + Token { + sgr: ColorForeground( + Rgb( + 0, + 0, + 114, + ), + ), + range: ( 0, - 114, + 15, ), - ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__color256-2.snap b/ansi2/src/snapshots/ansi2__test__color256-2.snap index 947f718..a48d606 100644 --- a/ansi2/src/snapshots/ansi2__test__color256-2.snap +++ b/ansi2/src/snapshots/ansi2__test__color256-2.snap @@ -18,6 +18,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 10, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color256( @@ -34,6 +74,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 21, + ), + color_r: ( + 0, + 10, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 21, + 22, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__color256-3.snap b/ansi2/src/snapshots/ansi2__test__color256-3.snap index 4f9d61d..b87414b 100644 --- a/ansi2/src/snapshots/ansi2__test__color256-3.snap +++ b/ansi2/src/snapshots/ansi2__test__color256-3.snap @@ -17,6 +17,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 10, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color256( @@ -33,6 +73,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 21, + ), + color_r: ( + 0, + 10, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 21, + 22, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__color256.snap b/ansi2/src/snapshots/ansi2__test__color256.snap index 5403a6d..790c9c2 100644 --- a/ansi2/src/snapshots/ansi2__test__color256.snap +++ b/ansi2/src/snapshots/ansi2__test__color256.snap @@ -5,21 +5,45 @@ expression: r ( "", [ - ColorForeground( - Color256( - 99, - ), - ), - Char( - 'a', - ), - ColorBackground( - Color256( - 99, - ), - ), - Char( - 'b', - ), + Token { + sgr: ColorForeground( + Color256( + 99, + ), + ), + range: ( + 0, + 10, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 10, + 11, + ), + }, + Token { + sgr: ColorBackground( + Color256( + 99, + ), + ), + range: ( + 11, + 21, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 21, + 22, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__dim-2.snap b/ansi2/src/snapshots/ansi2__test__dim-2.snap index 632abb7..48f4ed4 100644 --- a/ansi2/src/snapshots/ansi2__test__dim-2.snap +++ b/ansi2/src/snapshots/ansi2__test__dim-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 13, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -88,6 +328,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__dim-3.snap b/ansi2/src/snapshots/ansi2__test__dim-3.snap index 645a2bb..02c1b8c 100644 --- a/ansi2/src/snapshots/ansi2__test__dim-3.snap +++ b/ansi2/src/snapshots/ansi2__test__dim-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__dim.snap b/ansi2/src/snapshots/ansi2__test__dim.snap index 4a589d6..52b0db0 100644 --- a/ansi2/src/snapshots/ansi2__test__dim.snap +++ b/ansi2/src/snapshots/ansi2__test__dim.snap @@ -5,36 +5,96 @@ expression: r ( "", [ - ColorDefaultForeground, - List( - [ - Dim, - ColorDefaultForeground, - ], - ), - Char( - 'N', - ), - Char( - 'U', - ), - Char( - 'S', - ), - Char( - 'H', - ), - Char( - 'E', - ), - Char( - 'L', - ), - Char( - 'L', - ), - Unknown( - 27, - ), + Token { + sgr: ColorDefaultForeground, + range: ( + 0, + 5, + ), + }, + Token { + sgr: List( + [ + Dim, + ColorDefaultForeground, + ], + ), + range: ( + 5, + 12, + ), + }, + Token { + sgr: Char( + 'N', + ), + range: ( + 12, + 13, + ), + }, + Token { + sgr: Char( + 'U', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'S', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + 'H', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + 'E', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + 'L', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: Char( + 'L', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 19, + 20, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__empty_link-2.snap b/ansi2/src/snapshots/ansi2__test__empty_link-2.snap index c1eda2b..56826df 100644 --- a/ansi2/src/snapshots/ansi2__test__empty_link-2.snap +++ b/ansi2/src/snapshots/ansi2__test__empty_link-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 2, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 3, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 3, + 4, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 5, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 6, + 7, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__empty_link-3.snap b/ansi2/src/snapshots/ansi2__test__empty_link-3.snap index 534f312..a50517c 100644 --- a/ansi2/src/snapshots/ansi2__test__empty_link-3.snap +++ b/ansi2/src/snapshots/ansi2__test__empty_link-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 7, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__empty_link.snap b/ansi2/src/snapshots/ansi2__test__empty_link.snap index b2aa9d5..813cca9 100644 --- a/ansi2/src/snapshots/ansi2__test__empty_link.snap +++ b/ansi2/src/snapshots/ansi2__test__empty_link.snap @@ -5,26 +5,68 @@ expression: r ( "", [ - Unknown( - 27, - ), - Char( - ']', - ), - Char( - '8', - ), - Char( - ';', - ), - Char( - ';', - ), - Unknown( - 27, - ), - Char( - '\\', - ), + Token { + sgr: Unknown( + 27, + ), + range: ( + 0, + 1, + ), + }, + Token { + sgr: Char( + ']', + ), + range: ( + 1, + 2, + ), + }, + Token { + sgr: Char( + '8', + ), + range: ( + 2, + 3, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 3, + 4, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 4, + 5, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 5, + 6, + ), + }, + Token { + sgr: Char( + '\\', + ), + range: ( + 6, + 7, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__fastfetch.snap b/ansi2/src/snapshots/ansi2__test__fastfetch.snap index 2f94bca..c3da118 100644 --- a/ansi2/src/snapshots/ansi2__test__fastfetch.snap +++ b/ansi2/src/snapshots/ansi2__test__fastfetch.snap @@ -5,14 +5,32 @@ expression: r ( "", [ - CursorHorizontalAbsolute( - 1, - ), - CursorUp( - 19, - ), - CursorForward( - 47, - ), + Token { + sgr: CursorHorizontalAbsolute( + 1, + ), + range: ( + 0, + 4, + ), + }, + Token { + sgr: CursorUp( + 19, + ), + range: ( + 4, + 9, + ), + }, + Token { + sgr: CursorForward( + 47, + ), + range: ( + 9, + 14, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link-2.snap b/ansi2/src/snapshots/ansi2__test__link-2.snap index 021c426..0bfc330 100644 --- a/ansi2/src/snapshots/ansi2__test__link-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 2, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 3, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 3, + 4, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 5, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 6, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 6, + 7, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -88,6 +328,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 8, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -100,6 +380,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 9, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -112,6 +432,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -124,6 +484,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -136,6 +536,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 11, + 12, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -148,6 +588,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 13, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -160,6 +640,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -172,6 +692,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -184,6 +744,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -196,6 +796,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -208,6 +848,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -220,6 +900,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -232,6 +952,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 19, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -244,6 +1004,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 20, + 21, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -256,6 +1056,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 21, + 22, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -268,6 +1108,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 22, + 23, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -280,6 +1160,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 23, + 24, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -292,6 +1212,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 24, + 25, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -304,6 +1264,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 25, + 26, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -316,6 +1316,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 26, + 27, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -328,6 +1368,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 27, + 28, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -340,6 +1420,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 28, + 29, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -352,6 +1472,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 29, + 30, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -364,6 +1524,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 30, + 31, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -376,6 +1576,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 31, + 32, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -388,6 +1628,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 32, + 33, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -400,6 +1680,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 33, + 34, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -412,6 +1732,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 34, + 35, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -424,6 +1784,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -436,6 +1836,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 36, + 37, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -448,6 +1888,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 37, + 38, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -460,6 +1940,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 38, + 39, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -472,6 +1992,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 39, + 40, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -484,6 +2044,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 40, + 41, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -496,6 +2096,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 42, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -508,6 +2148,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -520,6 +2200,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 43, + 44, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -532,6 +2252,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 44, + 45, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -544,6 +2304,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 45, + 46, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -556,6 +2356,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 46, + 47, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -568,6 +2408,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 47, + 48, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -580,6 +2460,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 48, + 49, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -592,6 +2512,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 49, + 50, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -604,6 +2564,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 50, + 51, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -616,6 +2616,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 52, + 53, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -628,6 +2668,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 53, + 54, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -640,6 +2720,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 54, + 55, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -652,6 +2772,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 55, + 56, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -664,6 +2824,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 56, + 57, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -676,6 +2876,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 57, + 58, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -688,6 +2928,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 58, + 59, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -700,6 +2980,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 59, + 60, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -712,6 +3032,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 60, + 61, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -724,6 +3084,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 61, + 62, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -736,6 +3136,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 62, + 63, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -748,6 +3188,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 64, + 65, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -760,6 +3240,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 65, + 66, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -772,6 +3292,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 66, + 67, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -784,6 +3344,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 67, + 68, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link-3.snap b/ansi2/src/snapshots/ansi2__test__link-3.snap index ddae463..2d8e052 100644 --- a/ansi2/src/snapshots/ansi2__test__link-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 68, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link.snap b/ansi2/src/snapshots/ansi2__test__link.snap index 0e481cf..1fa9f54 100644 --- a/ansi2/src/snapshots/ansi2__test__link.snap +++ b/ansi2/src/snapshots/ansi2__test__link.snap @@ -5,212 +5,626 @@ expression: r ( "", [ - Unknown( - 27, - ), - Char( - ']', - ), - Char( - '8', - ), - Char( - ';', - ), - Char( - ';', - ), - Char( - 'f', - ), - Char( - 'i', - ), - Char( - 'l', - ), - Char( - 'e', - ), - Char( - ':', - ), - Char( - '/', - ), - Char( - '/', - ), - Char( - '/', - ), - Char( - 'U', - ), - Char( - 's', - ), - Char( - 'e', - ), - Char( - 'r', - ), - Char( - 's', - ), - Char( - '/', - ), - Char( - 'x', - ), - Char( - 'x', - ), - Char( - 'x', - ), - Char( - '/', - ), - Char( - 's', - ), - Char( - 'r', - ), - Char( - 'c', - ), - Char( - '/', - ), - Char( - 'n', - ), - Char( - 'e', - ), - Char( - 'w', - ), - Char( - '-', - ), - Char( - 'n', - ), - Char( - 'u', - ), - Char( - '-', - ), - Char( - 'p', - ), - Char( - 'a', - ), - Char( - 'r', - ), - Char( - 's', - ), - Char( - 'e', - ), - Char( - 'r', - ), - Char( - '/', - ), - Char( - 'C', - ), - Char( - 'a', - ), - Char( - 'r', - ), - Char( - 'g', - ), - Char( - 'o', - ), - Char( - '.', - ), - Char( - 't', - ), - Char( - 'o', - ), - Char( - 'm', - ), - Char( - 'l', - ), - Unknown( - 27, - ), - Char( - '\\', - ), - Char( - 'C', - ), - Char( - 'a', - ), - Char( - 'r', - ), - Char( - 'g', - ), - Char( - 'o', - ), - Char( - '.', - ), - Char( - 't', - ), - Char( - 'o', - ), - Char( - 'm', - ), - Char( - 'l', - ), - Unknown( - 27, - ), - Char( - ']', - ), - Char( - '8', - ), - Char( - ';', - ), - Char( - ';', - ), - Unknown( - 27, - ), + Token { + sgr: Unknown( + 27, + ), + range: ( + 0, + 1, + ), + }, + Token { + sgr: Char( + ']', + ), + range: ( + 1, + 2, + ), + }, + Token { + sgr: Char( + '8', + ), + range: ( + 2, + 3, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 3, + 4, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 4, + 5, + ), + }, + Token { + sgr: Char( + 'f', + ), + range: ( + 5, + 6, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 6, + 7, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 7, + 8, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 8, + 9, + ), + }, + Token { + sgr: Char( + ':', + ), + range: ( + 9, + 10, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 10, + 11, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 11, + 12, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 12, + 13, + ), + }, + Token { + sgr: Char( + 'U', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 's', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + 's', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: Char( + 'x', + ), + range: ( + 19, + 20, + ), + }, + Token { + sgr: Char( + 'x', + ), + range: ( + 20, + 21, + ), + }, + Token { + sgr: Char( + 'x', + ), + range: ( + 21, + 22, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 22, + 23, + ), + }, + Token { + sgr: Char( + 's', + ), + range: ( + 23, + 24, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 24, + 25, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 25, + 26, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 26, + 27, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 27, + 28, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 28, + 29, + ), + }, + Token { + sgr: Char( + 'w', + ), + range: ( + 29, + 30, + ), + }, + Token { + sgr: Char( + '-', + ), + range: ( + 30, + 31, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 31, + 32, + ), + }, + Token { + sgr: Char( + 'u', + ), + range: ( + 32, + 33, + ), + }, + Token { + sgr: Char( + '-', + ), + range: ( + 33, + 34, + ), + }, + Token { + sgr: Char( + 'p', + ), + range: ( + 34, + 35, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 35, + 36, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 36, + 37, + ), + }, + Token { + sgr: Char( + 's', + ), + range: ( + 37, + 38, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 38, + 39, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 39, + 40, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 40, + 41, + ), + }, + Token { + sgr: Char( + 'C', + ), + range: ( + 41, + 42, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 43, + 44, + ), + }, + Token { + sgr: Char( + 'g', + ), + range: ( + 44, + 45, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 45, + 46, + ), + }, + Token { + sgr: Char( + '.', + ), + range: ( + 46, + 47, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 47, + 48, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 48, + 49, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 49, + 50, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 50, + 51, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 51, + 52, + ), + }, + Token { + sgr: Char( + '\\', + ), + range: ( + 52, + 53, + ), + }, + Token { + sgr: Char( + 'C', + ), + range: ( + 53, + 54, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 54, + 55, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 55, + 56, + ), + }, + Token { + sgr: Char( + 'g', + ), + range: ( + 56, + 57, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 57, + 58, + ), + }, + Token { + sgr: Char( + '.', + ), + range: ( + 58, + 59, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 59, + 60, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 60, + 61, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 61, + 62, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 62, + 63, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 63, + 64, + ), + }, + Token { + sgr: Char( + ']', + ), + range: ( + 64, + 65, + ), + }, + Token { + sgr: Char( + '8', + ), + range: ( + 65, + 66, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 66, + 67, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 67, + 68, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 68, + 69, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link_hide-2.snap b/ansi2/src/snapshots/ansi2__test__link_hide-2.snap index 60d32b1..455b338 100644 --- a/ansi2/src/snapshots/ansi2__test__link_hide-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link_hide-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 5, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 6, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 6, + 7, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 8, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 9, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -88,6 +328,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -100,6 +380,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 11, + 12, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -112,6 +432,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 13, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -124,6 +484,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -136,6 +536,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -148,6 +588,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -160,6 +640,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -172,6 +692,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -184,6 +744,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -196,6 +796,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 19, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -208,6 +848,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 20, + 21, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -220,6 +900,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 21, + 22, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -232,6 +952,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 22, + 23, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -244,6 +1004,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 23, + 24, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -256,6 +1056,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 24, + 25, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -268,6 +1108,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 25, + 26, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -280,6 +1160,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 26, + 27, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -292,6 +1212,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 27, + 28, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -304,6 +1264,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 28, + 29, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -316,6 +1316,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 29, + 30, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -328,6 +1368,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 30, + 31, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -340,6 +1420,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 31, + 32, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -352,6 +1472,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 32, + 33, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -364,6 +1524,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 33, + 34, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -376,6 +1576,46 @@ Canvas { underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 34, + 35, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link_hide-3.snap b/ansi2/src/snapshots/ansi2__test__link_hide-3.snap index 5a76928..f16bef7 100644 --- a/ansi2/src/snapshots/ansi2__test__link_hide-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link_hide-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: true, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 35, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 4, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link_hide.snap b/ansi2/src/snapshots/ansi2__test__link_hide.snap index f4fa7d3..102ee9f 100644 --- a/ansi2/src/snapshots/ansi2__test__link_hide.snap +++ b/ansi2/src/snapshots/ansi2__test__link_hide.snap @@ -5,100 +5,298 @@ expression: r ( "", [ - CursorHide, - Char( - 'h', - ), - Char( - 't', - ), - Char( - 't', - ), - Char( - 'p', - ), - Char( - ':', - ), - Char( - '/', - ), - Char( - '/', - ), - Char( - 'e', - ), - Char( - 'x', - ), - Char( - 'a', - ), - Char( - 'm', - ), - Char( - 'p', - ), - Char( - 'l', - ), - Char( - 'e', - ), - Char( - '.', - ), - Char( - 'c', - ), - Char( - 'o', - ), - Char( - 'm', - ), - Char( - '/', - ), - Char( - 'h', - ), - Char( - 'o', - ), - Char( - 'w', - ), - Char( - '_', - ), - Char( - 'a', - ), - Char( - 'b', - ), - Char( - 'o', - ), - Char( - 'u', - ), - Char( - 't', - ), - Char( - '_', - ), - Char( - 'm', - ), - Char( - 'e', - ), - ColorReset, + Token { + sgr: CursorHide, + range: ( + 0, + 4, + ), + }, + Token { + sgr: Char( + 'h', + ), + range: ( + 4, + 5, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 5, + 6, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 6, + 7, + ), + }, + Token { + sgr: Char( + 'p', + ), + range: ( + 7, + 8, + ), + }, + Token { + sgr: Char( + ':', + ), + range: ( + 8, + 9, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 9, + 10, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 10, + 11, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 11, + 12, + ), + }, + Token { + sgr: Char( + 'x', + ), + range: ( + 12, + 13, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + 'p', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: Char( + '.', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 19, + 20, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 20, + 21, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 21, + 22, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 22, + 23, + ), + }, + Token { + sgr: Char( + 'h', + ), + range: ( + 23, + 24, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 24, + 25, + ), + }, + Token { + sgr: Char( + 'w', + ), + range: ( + 25, + 26, + ), + }, + Token { + sgr: Char( + '_', + ), + range: ( + 26, + 27, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 27, + 28, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 28, + 29, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 29, + 30, + ), + }, + Token { + sgr: Char( + 'u', + ), + range: ( + 30, + 31, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 31, + 32, + ), + }, + Token { + sgr: Char( + '_', + ), + range: ( + 32, + 33, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 33, + 34, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 34, + 35, + ), + }, + Token { + sgr: ColorReset, + range: ( + 35, + 38, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link_id-2.snap b/ansi2/src/snapshots/ansi2__test__link_id-2.snap index d2b2659..16f9b35 100644 --- a/ansi2/src/snapshots/ansi2__test__link_id-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link_id-2.snap @@ -16,6 +16,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 44, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 45, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 46, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 3, + 47, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 48, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link_id-3.snap b/ansi2/src/snapshots/ansi2__test__link_id-3.snap index 343e588..a5c7952 100644 --- a/ansi2/src/snapshots/ansi2__test__link_id-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link_id-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 48, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link_id.snap b/ansi2/src/snapshots/ansi2__test__link_id.snap index e9a8fc5..b45b800 100644 --- a/ansi2/src/snapshots/ansi2__test__link_id.snap +++ b/ansi2/src/snapshots/ansi2__test__link_id.snap @@ -5,9 +5,15 @@ expression: r ( "", [ - Link( - "id=1;http://example.com/id", - "twice", - ), + Token { + sgr: Link( + "id=1;http://example.com/id", + "twice", + ), + range: ( + 0, + 44, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link_ll-2.snap b/ansi2/src/snapshots/ansi2__test__link_ll-2.snap index 53b5d29..aaf00a7 100644 --- a/ansi2/src/snapshots/ansi2__test__link_ll-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link_ll-2.snap @@ -16,6 +16,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 48, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 49, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 50, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 3, + 51, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 52, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 53, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link_ll-2.snap.new b/ansi2/src/snapshots/ansi2__test__link_ll-2.snap.new deleted file mode 100644 index 296a6d0..0000000 --- a/ansi2/src/snapshots/ansi2__test__link_ll-2.snap.new +++ /dev/null @@ -1,85 +0,0 @@ ---- -source: ansi2/src/lib.rs -assertion_line: 569 -expression: canvas ---- -Canvas { - pixels: [ - [ - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "r", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "g", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "e", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - ], - ], - w: 7, - h: 1, -} diff --git a/ansi2/src/snapshots/ansi2__test__link_ll-3.snap b/ansi2/src/snapshots/ansi2__test__link_ll-3.snap index 096a7cb..d7cd87b 100644 --- a/ansi2/src/snapshots/ansi2__test__link_ll-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link_ll-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 53, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link_ll.snap b/ansi2/src/snapshots/ansi2__test__link_ll.snap index 7e840c7..ace5f8c 100644 --- a/ansi2/src/snapshots/ansi2__test__link_ll.snap +++ b/ansi2/src/snapshots/ansi2__test__link_ll.snap @@ -5,9 +5,15 @@ expression: r ( "", [ - Link( - "file://win/c/code/ansi2/target", - "target", - ), + Token { + sgr: Link( + "file://win/c/code/ansi2/target", + "target", + ), + range: ( + 0, + 48, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap b/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap index a3ab89a..544441a 100644 --- a/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap @@ -16,6 +16,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 71, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 72, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 73, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 4, + 75, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 5, + 76, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 6, + 77, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -88,6 +328,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 78, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -100,6 +380,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 79, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -112,6 +432,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 80, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -124,6 +484,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 81, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -136,6 +536,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 11, + 82, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -148,6 +588,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 83, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -160,6 +640,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 84, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -172,6 +692,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 85, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -184,6 +744,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 86, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -196,6 +796,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 87, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -208,6 +848,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 88, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -220,6 +900,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 89, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -232,6 +952,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 19, + 90, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -244,6 +1004,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 20, + 91, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -256,6 +1056,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 21, + 92, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -268,6 +1108,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 22, + 93, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -280,6 +1160,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 23, + 94, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -292,6 +1212,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 24, + 95, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -304,6 +1264,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 25, + 96, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -316,6 +1316,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 26, + 97, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -328,6 +1368,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 27, + 98, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -340,6 +1420,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 28, + 99, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -352,6 +1472,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 29, + 100, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -364,6 +1524,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 31, + 102, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -376,6 +1576,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 32, + 103, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -388,6 +1628,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 33, + 104, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -400,6 +1680,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 34, + 105, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -412,6 +1732,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 71, + 72, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -424,6 +1784,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 72, + 143, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -436,6 +1836,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 73, + 144, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -448,6 +1888,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 74, + 145, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -460,6 +1940,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 76, + 147, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -472,6 +1992,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 77, + 148, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -484,6 +2044,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 78, + 149, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -496,6 +2096,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 79, + 150, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -508,6 +2148,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 80, + 151, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -520,6 +2200,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 81, + 152, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -532,6 +2252,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 82, + 153, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -544,6 +2304,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 83, + 154, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -556,6 +2356,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 84, + 155, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -568,6 +2408,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 85, + 156, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -580,6 +2460,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 86, + 157, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -592,6 +2512,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 87, + 158, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -604,6 +2564,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 88, + 159, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -616,6 +2616,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 89, + 160, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -628,6 +2668,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 90, + 161, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -640,6 +2720,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 91, + 162, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -652,6 +2772,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 92, + 163, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -664,6 +2824,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 93, + 164, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -676,6 +2876,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 94, + 165, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -688,6 +2928,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 95, + 166, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -700,6 +2980,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 96, + 167, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -712,6 +3032,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 97, + 168, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -724,6 +3084,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 98, + 169, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -736,6 +3136,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 99, + 170, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -748,6 +3188,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 100, + 171, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -760,6 +3240,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 101, + 172, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -772,6 +3292,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 103, + 174, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -784,6 +3344,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 104, + 175, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -796,6 +3396,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 105, + 176, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -808,6 +3448,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 106, + 177, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap.new b/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap.new deleted file mode 100644 index de11375..0000000 --- a/ansi2/src/snapshots/ansi2__test__link_no_close-2.snap.new +++ /dev/null @@ -1,817 +0,0 @@ ---- -source: ansi2/src/lib.rs -assertion_line: 559 -expression: canvas ---- -Canvas { - pixels: [ - [ - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "f", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "]", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "8", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ";", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ";", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "h", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "p", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ":", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "e", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "x", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "m", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "p", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "l", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "e", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ".", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "c", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "m", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "f", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "\\", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "f", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: " ", - dim: false, - italic: false, - underline: false, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "f", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "]", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "8", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ";", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ";", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "h", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "t", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "p", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ":", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "e", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "x", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "m", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "p", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "l", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "e", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: ".", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "c", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "o", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "m", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "/", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "b", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "r", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "\\", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "b", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "r", - dim: false, - italic: false, - underline: true, - hide: false, - strike: false, - }, - ], - ], - w: 68, - h: 1, -} diff --git a/ansi2/src/snapshots/ansi2__test__link_no_close-3.snap b/ansi2/src/snapshots/ansi2__test__link_no_close-3.snap index 91583b7..00a73a5 100644 --- a/ansi2/src/snapshots/ansi2__test__link_no_close-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link_no_close-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 105, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -27,6 +67,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 71, + 72, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 0, + 71, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, Node { bg_color: Default, @@ -39,6 +119,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 71, + ), + color_r: ( + 0, + 71, + ), + bold_r: ( + 0, + 71, + ), + blink_r: ( + 0, + 71, + ), + text_r: ( + 72, + 177, + ), + dim_r: ( + 0, + 71, + ), + italic_r: ( + 0, + 71, + ), + underline_r: ( + 72, + 143, + ), + hide_r: ( + 0, + 71, + ), + strike_r: ( + 0, + 71, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link_no_close.snap b/ansi2/src/snapshots/ansi2__test__link_no_close.snap index 0dd9282..cb26397 100644 --- a/ansi2/src/snapshots/ansi2__test__link_no_close.snap +++ b/ansi2/src/snapshots/ansi2__test__link_no_close.snap @@ -5,16 +5,34 @@ expression: r ( "", [ - Link( - "http://example.com/foo", - "foo\u{1b}]8;;http://example.com/foo\u{1b}\\foo", - ), - Char( - ' ', - ), - Link( - "http://example.com/foo", - "foo\u{1b}]8;;http://example.com/bar\u{1b}\\bar", - ), + Token { + sgr: Link( + "http://example.com/foo", + "foo\u{1b}]8;;http://example.com/foo\u{1b}\\foo", + ), + range: ( + 0, + 71, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 71, + 72, + ), + }, + Token { + sgr: Link( + "http://example.com/foo", + "foo\u{1b}]8;;http://example.com/bar\u{1b}\\bar", + ), + range: ( + 72, + 143, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap b/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap index 0952ecb..0f06889 100644 --- a/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap +++ b/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap @@ -18,6 +18,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 56, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -32,6 +72,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 57, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -46,6 +126,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 58, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -58,6 +178,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 49, + ), + color_r: ( + 0, + 49, + ), + bold_r: ( + 0, + 49, + ), + blink_r: ( + 0, + 49, + ), + text_r: ( + 49, + 50, + ), + dim_r: ( + 0, + 49, + ), + italic_r: ( + 0, + 49, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 49, + ), + strike_r: ( + 0, + 49, + ), }, Node { bg_color: Default, @@ -70,6 +230,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 49, + ), + color_r: ( + 0, + 49, + ), + bold_r: ( + 0, + 49, + ), + blink_r: ( + 0, + 49, + ), + text_r: ( + 50, + 51, + ), + dim_r: ( + 0, + 49, + ), + italic_r: ( + 0, + 49, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 49, + ), + strike_r: ( + 0, + 49, + ), }, Node { bg_color: Default, @@ -82,6 +282,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 49, + ), + color_r: ( + 0, + 49, + ), + bold_r: ( + 0, + 49, + ), + blink_r: ( + 0, + 49, + ), + text_r: ( + 51, + 52, + ), + dim_r: ( + 0, + 49, + ), + italic_r: ( + 0, + 49, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 49, + ), + strike_r: ( + 0, + 49, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap.new b/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap.new deleted file mode 100644 index b68ef84..0000000 --- a/ansi2/src/snapshots/ansi2__test__link_soft_reset-2.snap.new +++ /dev/null @@ -1,91 +0,0 @@ ---- -source: ansi2/src/lib.rs -assertion_line: 548 -expression: canvas ---- -Canvas { - pixels: [ - [ - Node { - bg_color: Default, - color: Color8( - Red, - ), - bold: false, - blink: false, - text: "f", - dim: false, - italic: true, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Color8( - Red, - ), - bold: false, - blink: false, - text: "o", - dim: false, - italic: true, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Color8( - Red, - ), - bold: false, - blink: false, - text: "o", - dim: false, - italic: true, - underline: true, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "b", - dim: false, - italic: false, - underline: false, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "a", - dim: false, - italic: false, - underline: false, - hide: false, - strike: false, - }, - Node { - bg_color: Default, - color: Default, - bold: false, - blink: false, - text: "r", - dim: false, - italic: false, - underline: false, - hide: false, - strike: false, - }, - ], - ], - w: 7, - h: 1, -} diff --git a/ansi2/src/snapshots/ansi2__test__link_soft_reset-3.snap b/ansi2/src/snapshots/ansi2__test__link_soft_reset-3.snap index d98d91e..7ba412d 100644 --- a/ansi2/src/snapshots/ansi2__test__link_soft_reset-3.snap +++ b/ansi2/src/snapshots/ansi2__test__link_soft_reset-3.snap @@ -17,6 +17,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 58, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -29,6 +69,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 49, + ), + color_r: ( + 0, + 49, + ), + bold_r: ( + 0, + 49, + ), + blink_r: ( + 0, + 49, + ), + text_r: ( + 49, + 52, + ), + dim_r: ( + 0, + 49, + ), + italic_r: ( + 0, + 49, + ), + underline_r: ( + 0, + 49, + ), + hide_r: ( + 0, + 49, + ), + strike_r: ( + 0, + 49, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__link_soft_reset.snap b/ansi2/src/snapshots/ansi2__test__link_soft_reset.snap index 89e88ba..19a0da3 100644 --- a/ansi2/src/snapshots/ansi2__test__link_soft_reset.snap +++ b/ansi2/src/snapshots/ansi2__test__link_soft_reset.snap @@ -5,18 +5,42 @@ expression: r ( "", [ - Link( - "http://example.com/softreset", - "\u{1b}[3;31mfoo", - ), - Char( - 'b', - ), - Char( - 'a', - ), - Char( - 'r', - ), + Token { + sgr: Link( + "http://example.com/softreset", + "\u{1b}[3;31mfoo", + ), + range: ( + 0, + 49, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 49, + 50, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 50, + 51, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 51, + 52, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__plain-2.snap b/ansi2/src/snapshots/ansi2__test__plain-2.snap index 8b94c0d..ad742a3 100644 --- a/ansi2/src/snapshots/ansi2__test__plain-2.snap +++ b/ansi2/src/snapshots/ansi2__test__plain-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 1, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 2, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 3, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 3, + 4, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__plain-3.snap b/ansi2/src/snapshots/ansi2__test__plain-3.snap index d010514..70c1ec0 100644 --- a/ansi2/src/snapshots/ansi2__test__plain-3.snap +++ b/ansi2/src/snapshots/ansi2__test__plain-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 4, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__plain.snap b/ansi2/src/snapshots/ansi2__test__plain.snap index 24f6a8a..251ee0a 100644 --- a/ansi2/src/snapshots/ansi2__test__plain.snap +++ b/ansi2/src/snapshots/ansi2__test__plain.snap @@ -5,17 +5,41 @@ expression: r ( "", [ - Char( - 'a', - ), - Char( - 'n', - ), - Char( - 's', - ), - Char( - 'i', - ), + Token { + sgr: Char( + 'a', + ), + range: ( + 0, + 1, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 1, + 2, + ), + }, + Token { + sgr: Char( + 's', + ), + range: ( + 2, + 3, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 3, + 4, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__reset.snap b/ansi2/src/snapshots/ansi2__test__reset.snap index bbf3128..d1f40f3 100644 --- a/ansi2/src/snapshots/ansi2__test__reset.snap +++ b/ansi2/src/snapshots/ansi2__test__reset.snap @@ -5,9 +5,21 @@ expression: r ( "", [ - ColorReset, - Unknown( - 27, - ), + Token { + sgr: ColorReset, + range: ( + 0, + 3, + ), + }, + Token { + sgr: Unknown( + 27, + ), + range: ( + 3, + 4, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__sgr4-2.snap b/ansi2/src/snapshots/ansi2__test__sgr4-2.snap index 7eea573..d4ddf5f 100644 --- a/ansi2/src/snapshots/ansi2__test__sgr4-2.snap +++ b/ansi2/src/snapshots/ansi2__test__sgr4-2.snap @@ -18,6 +18,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 13, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color256( @@ -32,6 +72,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color256( @@ -46,6 +126,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__sgr4-3.snap b/ansi2/src/snapshots/ansi2__test__sgr4-3.snap index 2326284..5369542 100644 --- a/ansi2/src/snapshots/ansi2__test__sgr4-3.snap +++ b/ansi2/src/snapshots/ansi2__test__sgr4-3.snap @@ -17,6 +17,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__sgr4.snap b/ansi2/src/snapshots/ansi2__test__sgr4.snap index 15a583b..8dd8619 100644 --- a/ansi2/src/snapshots/ansi2__test__sgr4.snap +++ b/ansi2/src/snapshots/ansi2__test__sgr4.snap @@ -5,24 +5,48 @@ expression: r ( "", [ - List( - [ - ColorReset, - ColorBackground( - Color256( - 45, + Token { + sgr: List( + [ + ColorReset, + ColorBackground( + Color256( + 45, + ), ), - ), - ], - ), - Char( - 'a', - ), - Char( - 'a', - ), - Char( - 'a', - ), + ], + ), + range: ( + 0, + 12, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 12, + 13, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 14, + 15, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__sgr6.snap b/ansi2/src/snapshots/ansi2__test__sgr6.snap index a5138b6..d5795de 100644 --- a/ansi2/src/snapshots/ansi2__test__sgr6.snap +++ b/ansi2/src/snapshots/ansi2__test__sgr6.snap @@ -5,13 +5,19 @@ expression: r ( "", [ - ColorFgBg( - Color256( - 16, + Token { + sgr: ColorFgBg( + Color256( + 16, + ), + Color256( + 186, + ), ), - Color256( - 186, + range: ( + 0, + 19, ), - ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__starship_prompt-2.snap b/ansi2/src/snapshots/ansi2__test__starship_prompt-2.snap index c280fcc..ea5a041 100644 --- a/ansi2/src/snapshots/ansi2__test__starship_prompt-2.snap +++ b/ansi2/src/snapshots/ansi2__test__starship_prompt-2.snap @@ -20,6 +20,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 18, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -38,6 +78,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 19, + 40, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 40, + 41, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -56,6 +136,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 19, + 40, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 42, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -74,6 +194,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 19, + 40, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -94,6 +254,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 43, + 61, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 61, + 62, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -112,6 +312,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 67, + 68, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -130,6 +370,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 68, + 69, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -148,6 +428,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 69, + 70, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -166,6 +486,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 70, + 71, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -184,6 +544,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 71, + 72, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -202,6 +602,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 72, + 73, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -222,6 +662,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 73, + 108, + ), + color_r: ( + 73, + 108, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 108, + 109, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -242,6 +722,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 109, + 145, + ), + color_r: ( + 109, + 145, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 145, + 146, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -262,6 +782,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 146, + 180, + ), + color_r: ( + 146, + 180, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 180, + 181, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -282,6 +842,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 181, + 214, + ), + color_r: ( + 181, + 214, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 214, + 215, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__starship_prompt-3.snap b/ansi2/src/snapshots/ansi2__test__starship_prompt-3.snap index 5b13012..95f6408 100644 --- a/ansi2/src/snapshots/ansi2__test__starship_prompt-3.snap +++ b/ansi2/src/snapshots/ansi2__test__starship_prompt-3.snap @@ -19,6 +19,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 18, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -37,6 +77,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 19, + 40, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 40, + 43, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -57,6 +137,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 43, + 61, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 61, + 62, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -75,6 +195,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 19, + 40, + ), + color_r: ( + 62, + 67, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 67, + 73, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -95,6 +255,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 73, + 108, + ), + color_r: ( + 73, + 108, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 108, + 109, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -115,6 +315,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 109, + 145, + ), + color_r: ( + 109, + 145, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 145, + 146, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -135,6 +375,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 146, + 180, + ), + color_r: ( + 146, + 180, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 180, + 181, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Rgb( @@ -155,6 +435,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 181, + 214, + ), + color_r: ( + 181, + 214, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 214, + 215, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__starship_prompt.snap b/ansi2/src/snapshots/ansi2__test__starship_prompt.snap index 6866ed0..d5842d2 100644 --- a/ansi2/src/snapshots/ansi2__test__starship_prompt.snap +++ b/ansi2/src/snapshots/ansi2__test__starship_prompt.snap @@ -5,131 +5,281 @@ expression: r ( "", [ - ColorForeground( - Rgb( - 218, - 98, - 125, - ), - ), - Char( - '\u{e0b6}', - ), - ColorFgBg( - Color8( - Black, - ), - Rgb( - 218, - 98, - 125, - ), - ), - Char( - 'w', - ), - Char( - 'i', - ), - Char( - 'n', - ), - ColorForeground( - Rgb( - 218, - 98, - 125, - ), - ), - Char( - '\u{e0b0}', - ), - ColorForeground( - Color8( - Black, - ), - ), - Char( - 'C', - ), - Char( - ':', - ), - Char( - '/', - ), - Char( - 'w', - ), - Char( - 't', - ), - Char( - ' ', - ), - ColorFgBg( - Rgb( - 218, - 98, - 125, - ), - Rgb( - 252, - 161, - 125, - ), - ), - Char( - '\u{e0b0}', - ), - ColorFgBg( - Rgb( - 252, - 161, - 125, - ), - Rgb( - 134, - 187, - 216, - ), - ), - Char( - '\u{e0b0}', - ), - ColorFgBg( - Rgb( - 134, - 187, - 216, - ), - Rgb( - 6, - 150, - 154, - ), - ), - Char( - '\u{e0b0}', - ), - ColorFgBg( - Rgb( - 6, - 150, - 154, - ), - Rgb( - 51, - 101, - 138, - ), - ), - Char( - '\u{e0b0}', - ), - ColorReset, - EraseInLine( - 0, - ), + Token { + sgr: ColorForeground( + Rgb( + 218, + 98, + 125, + ), + ), + range: ( + 0, + 18, + ), + }, + Token { + sgr: Char( + '\u{e0b6}', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: ColorFgBg( + Color8( + Black, + ), + Rgb( + 218, + 98, + 125, + ), + ), + range: ( + 19, + 40, + ), + }, + Token { + sgr: Char( + 'w', + ), + range: ( + 40, + 41, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 41, + 42, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: ColorForeground( + Rgb( + 218, + 98, + 125, + ), + ), + range: ( + 43, + 61, + ), + }, + Token { + sgr: Char( + '\u{e0b0}', + ), + range: ( + 61, + 62, + ), + }, + Token { + sgr: ColorForeground( + Color8( + Black, + ), + ), + range: ( + 62, + 67, + ), + }, + Token { + sgr: Char( + 'C', + ), + range: ( + 67, + 68, + ), + }, + Token { + sgr: Char( + ':', + ), + range: ( + 68, + 69, + ), + }, + Token { + sgr: Char( + '/', + ), + range: ( + 69, + 70, + ), + }, + Token { + sgr: Char( + 'w', + ), + range: ( + 70, + 71, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 71, + 72, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 72, + 73, + ), + }, + Token { + sgr: ColorFgBg( + Rgb( + 218, + 98, + 125, + ), + Rgb( + 252, + 161, + 125, + ), + ), + range: ( + 73, + 108, + ), + }, + Token { + sgr: Char( + '\u{e0b0}', + ), + range: ( + 108, + 109, + ), + }, + Token { + sgr: ColorFgBg( + Rgb( + 252, + 161, + 125, + ), + Rgb( + 134, + 187, + 216, + ), + ), + range: ( + 109, + 145, + ), + }, + Token { + sgr: Char( + '\u{e0b0}', + ), + range: ( + 145, + 146, + ), + }, + Token { + sgr: ColorFgBg( + Rgb( + 134, + 187, + 216, + ), + Rgb( + 6, + 150, + 154, + ), + ), + range: ( + 146, + 180, + ), + }, + Token { + sgr: Char( + '\u{e0b0}', + ), + range: ( + 180, + 181, + ), + }, + Token { + sgr: ColorFgBg( + Rgb( + 6, + 150, + 154, + ), + Rgb( + 51, + 101, + 138, + ), + ), + range: ( + 181, + 214, + ), + }, + Token { + sgr: Char( + '\u{e0b0}', + ), + range: ( + 214, + 215, + ), + }, + Token { + sgr: ColorReset, + range: ( + 215, + 219, + ), + }, + Token { + sgr: EraseInLine( + 0, + ), + range: ( + 219, + 222, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__starship_title.snap b/ansi2/src/snapshots/ansi2__test__starship_title.snap index 85441f0..2e5005b 100644 --- a/ansi2/src/snapshots/ansi2__test__starship_title.snap +++ b/ansi2/src/snapshots/ansi2__test__starship_title.snap @@ -5,22 +5,64 @@ expression: r ( "", [ - CursorHide, - Title( - "/c/wt", - ), - ColorForeground( - Color8( - Black, - ), - ), - Bold, - ColorReset, - EraseInDisplay( - 0, - ), - EraseInLine( - 0, - ), + Token { + sgr: CursorHide, + range: ( + 0, + 8, + ), + }, + Token { + sgr: Title( + "/c/wt", + ), + range: ( + 8, + 18, + ), + }, + Token { + sgr: ColorForeground( + Color8( + Black, + ), + ), + range: ( + 18, + 23, + ), + }, + Token { + sgr: Bold, + range: ( + 23, + 26, + ), + }, + Token { + sgr: ColorReset, + range: ( + 26, + 29, + ), + }, + Token { + sgr: EraseInDisplay( + 0, + ), + range: ( + 29, + 32, + ), + }, + Token { + sgr: EraseInLine( + 0, + ), + range: ( + 32, + 35, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__style-2.snap b/ansi2/src/snapshots/ansi2__test__style-2.snap index 3e8bb77..c31bdb5 100644 --- a/ansi2/src/snapshots/ansi2__test__style-2.snap +++ b/ansi2/src/snapshots/ansi2__test__style-2.snap @@ -16,6 +16,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 1, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -28,6 +68,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 1, + 2, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -40,6 +120,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 2, + 3, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -52,6 +172,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 3, + 7, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 8, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -64,6 +224,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 3, + 7, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 9, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -76,6 +276,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 3, + 7, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -88,6 +328,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 3, + 7, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -100,6 +380,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 11, + 15, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -112,6 +432,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 20, + 21, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -124,6 +484,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 21, + 22, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -136,6 +536,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 22, + 23, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -148,6 +588,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 27, + 28, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 23, + 27, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -160,6 +640,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 32, + 33, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -172,6 +692,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 33, + 34, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -184,6 +744,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 34, + 35, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -196,6 +796,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -208,6 +848,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 36, + 37, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -220,6 +900,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 37, + 38, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -232,6 +952,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -244,6 +1004,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 47, + 48, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -256,6 +1056,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 48, + 49, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -268,6 +1108,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 49, + 50, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -280,6 +1160,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 50, + 51, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -292,6 +1212,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 51, + 52, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -304,6 +1264,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 52, + 53, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -316,6 +1316,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 53, + 54, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -328,6 +1368,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 54, + 55, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -340,6 +1420,46 @@ Canvas { underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 55, + 56, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__style-3.snap b/ansi2/src/snapshots/ansi2__test__style-3.snap index beeed03..e4ed9a7 100644 --- a/ansi2/src/snapshots/ansi2__test__style-3.snap +++ b/ansi2/src/snapshots/ansi2__test__style-3.snap @@ -15,6 +15,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 0, + 3, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -27,6 +67,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 3, + 7, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 7, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -39,6 +119,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 11, + 15, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -51,6 +171,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 11, + 15, + ), + color_r: ( + 11, + 15, + ), + bold_r: ( + 11, + 15, + ), + blink_r: ( + 11, + 15, + ), + text_r: ( + 20, + 23, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 11, + 15, + ), + underline_r: ( + 11, + 15, + ), + hide_r: ( + 11, + 15, + ), + strike_r: ( + 11, + 15, + ), }, Node { bg_color: Default, @@ -63,6 +223,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 27, + 28, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 23, + 27, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -75,6 +275,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 32, + 43, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 28, + 32, + ), + underline_r: ( + 23, + 27, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, Node { bg_color: Default, @@ -87,6 +327,46 @@ expression: canvas.minify() underline: true, hide: false, strike: false, + bg_color_r: ( + 23, + 27, + ), + color_r: ( + 23, + 27, + ), + bold_r: ( + 23, + 27, + ), + blink_r: ( + 23, + 27, + ), + text_r: ( + 47, + 56, + ), + dim_r: ( + 23, + 27, + ), + italic_r: ( + 38, + 42, + ), + underline_r: ( + 43, + 47, + ), + hide_r: ( + 23, + 27, + ), + strike_r: ( + 23, + 27, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__style.snap b/ansi2/src/snapshots/ansi2__test__style.snap index 6da072f..5f4c99c 100644 --- a/ansi2/src/snapshots/ansi2__test__style.snap +++ b/ansi2/src/snapshots/ansi2__test__style.snap @@ -5,97 +5,313 @@ expression: r ( "", [ - Char( - 'a', - ), - Char( - 'a', - ), - Char( - 'a', - ), - Bold, - Char( - 'b', - ), - Char( - 'o', - ), - Char( - 'l', - ), - Char( - 'd', - ), - ColorReset, - Char( - ' ', - ), - Dim, - Char( - 'd', - ), - Char( - 'i', - ), - Char( - 'm', - ), - ColorReset, - Char( - ' ', - ), - Italic, - Char( - 'i', - ), - Char( - 't', - ), - Char( - 'a', - ), - Char( - 'l', - ), - Char( - 'i', - ), - Char( - 'c', - ), - Italic, - Char( - ' ', - ), - Underline, - Char( - 'u', - ), - Char( - 'n', - ), - Char( - 'd', - ), - Char( - 'e', - ), - Char( - 'r', - ), - Char( - 'l', - ), - Char( - 'i', - ), - Char( - 'n', - ), - Char( - 'e', - ), - Underline, + Token { + sgr: Char( + 'a', + ), + range: ( + 0, + 1, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 1, + 2, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 2, + 3, + ), + }, + Token { + sgr: Bold, + range: ( + 3, + 7, + ), + }, + Token { + sgr: Char( + 'b', + ), + range: ( + 7, + 8, + ), + }, + Token { + sgr: Char( + 'o', + ), + range: ( + 8, + 9, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 9, + 10, + ), + }, + Token { + sgr: Char( + 'd', + ), + range: ( + 10, + 11, + ), + }, + Token { + sgr: ColorReset, + range: ( + 11, + 15, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Dim, + range: ( + 16, + 20, + ), + }, + Token { + sgr: Char( + 'd', + ), + range: ( + 20, + 21, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 21, + 22, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 22, + 23, + ), + }, + Token { + sgr: ColorReset, + range: ( + 23, + 27, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 27, + 28, + ), + }, + Token { + sgr: Italic, + range: ( + 28, + 32, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 32, + 33, + ), + }, + Token { + sgr: Char( + 't', + ), + range: ( + 33, + 34, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 34, + 35, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 35, + 36, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 36, + 37, + ), + }, + Token { + sgr: Char( + 'c', + ), + range: ( + 37, + 38, + ), + }, + Token { + sgr: Italic, + range: ( + 38, + 42, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: Underline, + range: ( + 43, + 47, + ), + }, + Token { + sgr: Char( + 'u', + ), + range: ( + 47, + 48, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 48, + 49, + ), + }, + Token { + sgr: Char( + 'd', + ), + range: ( + 49, + 50, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 50, + 51, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 51, + 52, + ), + }, + Token { + sgr: Char( + 'l', + ), + range: ( + 52, + 53, + ), + }, + Token { + sgr: Char( + 'i', + ), + range: ( + 53, + 54, + ), + }, + Token { + sgr: Char( + 'n', + ), + range: ( + 54, + 55, + ), + }, + Token { + sgr: Char( + 'e', + ), + range: ( + 55, + 56, + ), + }, + Token { + sgr: Underline, + range: ( + 56, + 60, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__svg2-2.snap b/ansi2/src/snapshots/ansi2__test__svg2-2.snap index 3f56c78..4ee300c 100644 --- a/ansi2/src/snapshots/ansi2__test__svg2-2.snap +++ b/ansi2/src/snapshots/ansi2__test__svg2-2.snap @@ -18,6 +18,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 9, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -32,6 +72,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 9, + 10, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -46,6 +126,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 10, + 11, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -60,6 +180,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 11, + 12, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -74,6 +234,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 12, + 13, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -88,6 +288,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -102,6 +342,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -116,6 +396,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -130,6 +450,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 28, + 29, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -144,6 +504,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 29, + 30, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -158,6 +558,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 30, + 31, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -172,6 +612,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 31, + 32, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -186,6 +666,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 32, + 33, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -200,6 +720,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 33, + 34, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, Node { bg_color: Color8( @@ -214,6 +774,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 34, + 35, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__svg2-3.snap b/ansi2/src/snapshots/ansi2__test__svg2-3.snap index 79029a5..a122c78 100644 --- a/ansi2/src/snapshots/ansi2__test__svg2-3.snap +++ b/ansi2/src/snapshots/ansi2__test__svg2-3.snap @@ -17,6 +17,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 0, + 0, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 8, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -31,6 +71,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 0, + 0, + ), + color_r: ( + 0, + 0, + ), + bold_r: ( + 16, + 20, + ), + blink_r: ( + 16, + 20, + ), + text_r: ( + 28, + 35, + ), + dim_r: ( + 16, + 20, + ), + italic_r: ( + 16, + 20, + ), + underline_r: ( + 16, + 20, + ), + hide_r: ( + 16, + 20, + ), + strike_r: ( + 16, + 20, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__svg2.snap b/ansi2/src/snapshots/ansi2__test__svg2.snap index a2bf9c4..9b3f505 100644 --- a/ansi2/src/snapshots/ansi2__test__svg2.snap +++ b/ansi2/src/snapshots/ansi2__test__svg2.snap @@ -5,71 +5,179 @@ expression: r ( "", [ - List( - [ - ColorDefaultForeground, - ColorBackground( - Color8( - Black, + Token { + sgr: List( + [ + ColorDefaultForeground, + ColorBackground( + Color8( + Black, + ), ), - ), - ], - ), - Char( - ' ', - ), - Char( - '3', - ), - Char( - '9', - ), - Char( - ';', - ), - Char( - '4', - ), - Char( - '0', - ), - Char( - 'm', - ), - Char( - ' ', - ), - ColorReset, - List( - [ - ColorDefaultForeground, - ColorBackground( - Color8( - Red, + ], + ), + range: ( + 0, + 8, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 8, + 9, + ), + }, + Token { + sgr: Char( + '3', + ), + range: ( + 9, + 10, + ), + }, + Token { + sgr: Char( + '9', + ), + range: ( + 10, + 11, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 11, + 12, + ), + }, + Token { + sgr: Char( + '4', + ), + range: ( + 12, + 13, + ), + }, + Token { + sgr: Char( + '0', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: ColorReset, + range: ( + 16, + 20, + ), + }, + Token { + sgr: List( + [ + ColorDefaultForeground, + ColorBackground( + Color8( + Red, + ), ), - ), - ], - ), - Char( - ' ', - ), - Char( - '3', - ), - Char( - '9', - ), - Char( - ';', - ), - Char( - '4', - ), - Char( - '1', - ), - Char( - 'm', - ), + ], + ), + range: ( + 20, + 28, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 28, + 29, + ), + }, + Token { + sgr: Char( + '3', + ), + range: ( + 29, + 30, + ), + }, + Token { + sgr: Char( + '9', + ), + range: ( + 30, + 31, + ), + }, + Token { + sgr: Char( + ';', + ), + range: ( + 31, + 32, + ), + }, + Token { + sgr: Char( + '4', + ), + range: ( + 32, + 33, + ), + }, + Token { + sgr: Char( + '1', + ), + range: ( + 33, + 34, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 34, + 35, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__test.snap b/ansi2/src/snapshots/ansi2__test__test.snap index b700111..1743bb4 100644 --- a/ansi2/src/snapshots/ansi2__test__test.snap +++ b/ansi2/src/snapshots/ansi2__test__test.snap @@ -5,21 +5,27 @@ expression: r ( "", [ - List( - [ - ColorReset, - SlowBlink, - ColorForeground( - Color8( - Magenta, + Token { + sgr: List( + [ + ColorReset, + SlowBlink, + ColorForeground( + Color8( + Magenta, + ), ), - ), - ColorBackground( - Color8( - Magenta, + ColorBackground( + Color8( + Magenta, + ), ), - ), - ], - ), + ], + ), + range: ( + 0, + 12, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__vitest-2.snap b/ansi2/src/snapshots/ansi2__test__vitest-2.snap index fc96efe..818e567 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest-2.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest-2.snap @@ -20,6 +20,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -36,6 +76,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -52,6 +132,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -68,6 +188,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -84,6 +244,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -100,6 +300,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -116,6 +356,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 19, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -128,6 +408,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 30, + 35, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -142,6 +462,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 42, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -156,6 +516,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -170,6 +570,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 43, + 44, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -184,6 +624,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 44, + 45, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -198,6 +678,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 45, + 46, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -212,6 +732,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 46, + 47, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -226,6 +786,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 47, + 48, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__vitest-3.snap b/ansi2/src/snapshots/ansi2__test__vitest-3.snap index 6ec0aaf..9f43f29 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest-3.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest-3.snap @@ -19,6 +19,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -31,6 +71,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 30, + 35, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -45,6 +125,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 48, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__vitest.snap b/ansi2/src/snapshots/ansi2__test__vitest.snap index 94e1425..aee264a 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest.snap @@ -5,66 +5,204 @@ expression: r ( "", [ - ColorForeground( - Color8( - Cyan, - ), - ), - Reverse, - Bold, - Char( - ' ', - ), - Char( - 'B', - ), - Char( - 'E', - ), - Char( - 'N', - ), - Char( - 'C', - ), - Char( - 'H', - ), - Char( - ' ', - ), - NormalIntensity, - UnReversed, - ColorDefaultForeground, - Char( - ' ', - ), - ColorForeground( - Color8( - Cyan, - ), - ), - Char( - 'S', - ), - Char( - 'u', - ), - Char( - 'm', - ), - Char( - 'm', - ), - Char( - 'a', - ), - Char( - 'r', - ), - Char( - 'y', - ), - ColorDefaultForeground, + Token { + sgr: ColorForeground( + Color8( + Cyan, + ), + ), + range: ( + 0, + 5, + ), + }, + Token { + sgr: Reverse, + range: ( + 5, + 9, + ), + }, + Token { + sgr: Bold, + range: ( + 9, + 13, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'B', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + 'E', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + 'N', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + 'C', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: Char( + 'H', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 19, + 20, + ), + }, + Token { + sgr: NormalIntensity, + range: ( + 20, + 25, + ), + }, + Token { + sgr: UnReversed, + range: ( + 25, + 30, + ), + }, + Token { + sgr: ColorDefaultForeground, + range: ( + 30, + 35, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 35, + 36, + ), + }, + Token { + sgr: ColorForeground( + Color8( + Cyan, + ), + ), + range: ( + 36, + 41, + ), + }, + Token { + sgr: Char( + 'S', + ), + range: ( + 41, + 42, + ), + }, + Token { + sgr: Char( + 'u', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 43, + 44, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 44, + 45, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 45, + 46, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 46, + 47, + ), + }, + Token { + sgr: Char( + 'y', + ), + range: ( + 47, + 48, + ), + }, + Token { + sgr: ColorDefaultForeground, + range: ( + 48, + 53, + ), + }, ], ) diff --git a/ansi2/src/snapshots/ansi2__test__vitest_bench-2.snap b/ansi2/src/snapshots/ansi2__test__vitest_bench-2.snap index fc96efe..818e567 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest_bench-2.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest_bench-2.snap @@ -20,6 +20,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 14, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -36,6 +76,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 14, + 15, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -52,6 +132,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 15, + 16, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -68,6 +188,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 16, + 17, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -84,6 +244,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 17, + 18, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -100,6 +300,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 18, + 19, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Color8( @@ -116,6 +356,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 19, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -128,6 +408,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 30, + 35, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -142,6 +462,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 42, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -156,6 +516,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 42, + 43, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -170,6 +570,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 43, + 44, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -184,6 +624,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 44, + 45, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -198,6 +678,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 45, + 46, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -212,6 +732,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 46, + 47, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -226,6 +786,46 @@ Canvas { underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 47, + 48, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ], diff --git a/ansi2/src/snapshots/ansi2__test__vitest_bench-3.snap b/ansi2/src/snapshots/ansi2__test__vitest_bench-3.snap index 6ec0aaf..9f43f29 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest_bench-3.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest_bench-3.snap @@ -19,6 +19,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 5, + 9, + ), + color_r: ( + 5, + 9, + ), + bold_r: ( + 9, + 13, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 13, + 20, + ), + dim_r: ( + 0, + 0, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -31,6 +71,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 30, + 35, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 35, + 36, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, Node { bg_color: Default, @@ -45,6 +125,46 @@ expression: canvas.minify() underline: false, hide: false, strike: false, + bg_color_r: ( + 25, + 30, + ), + color_r: ( + 36, + 41, + ), + bold_r: ( + 20, + 25, + ), + blink_r: ( + 0, + 0, + ), + text_r: ( + 41, + 48, + ), + dim_r: ( + 20, + 25, + ), + italic_r: ( + 0, + 0, + ), + underline_r: ( + 0, + 0, + ), + hide_r: ( + 0, + 0, + ), + strike_r: ( + 0, + 0, + ), }, ], ] diff --git a/ansi2/src/snapshots/ansi2__test__vitest_bench.snap b/ansi2/src/snapshots/ansi2__test__vitest_bench.snap index 94e1425..aee264a 100644 --- a/ansi2/src/snapshots/ansi2__test__vitest_bench.snap +++ b/ansi2/src/snapshots/ansi2__test__vitest_bench.snap @@ -5,66 +5,204 @@ expression: r ( "", [ - ColorForeground( - Color8( - Cyan, - ), - ), - Reverse, - Bold, - Char( - ' ', - ), - Char( - 'B', - ), - Char( - 'E', - ), - Char( - 'N', - ), - Char( - 'C', - ), - Char( - 'H', - ), - Char( - ' ', - ), - NormalIntensity, - UnReversed, - ColorDefaultForeground, - Char( - ' ', - ), - ColorForeground( - Color8( - Cyan, - ), - ), - Char( - 'S', - ), - Char( - 'u', - ), - Char( - 'm', - ), - Char( - 'm', - ), - Char( - 'a', - ), - Char( - 'r', - ), - Char( - 'y', - ), - ColorDefaultForeground, + Token { + sgr: ColorForeground( + Color8( + Cyan, + ), + ), + range: ( + 0, + 5, + ), + }, + Token { + sgr: Reverse, + range: ( + 5, + 9, + ), + }, + Token { + sgr: Bold, + range: ( + 9, + 13, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 13, + 14, + ), + }, + Token { + sgr: Char( + 'B', + ), + range: ( + 14, + 15, + ), + }, + Token { + sgr: Char( + 'E', + ), + range: ( + 15, + 16, + ), + }, + Token { + sgr: Char( + 'N', + ), + range: ( + 16, + 17, + ), + }, + Token { + sgr: Char( + 'C', + ), + range: ( + 17, + 18, + ), + }, + Token { + sgr: Char( + 'H', + ), + range: ( + 18, + 19, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 19, + 20, + ), + }, + Token { + sgr: NormalIntensity, + range: ( + 20, + 25, + ), + }, + Token { + sgr: UnReversed, + range: ( + 25, + 30, + ), + }, + Token { + sgr: ColorDefaultForeground, + range: ( + 30, + 35, + ), + }, + Token { + sgr: Char( + ' ', + ), + range: ( + 35, + 36, + ), + }, + Token { + sgr: ColorForeground( + Color8( + Cyan, + ), + ), + range: ( + 36, + 41, + ), + }, + Token { + sgr: Char( + 'S', + ), + range: ( + 41, + 42, + ), + }, + Token { + sgr: Char( + 'u', + ), + range: ( + 42, + 43, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 43, + 44, + ), + }, + Token { + sgr: Char( + 'm', + ), + range: ( + 44, + 45, + ), + }, + Token { + sgr: Char( + 'a', + ), + range: ( + 45, + 46, + ), + }, + Token { + sgr: Char( + 'r', + ), + range: ( + 46, + 47, + ), + }, + Token { + sgr: Char( + 'y', + ), + range: ( + 47, + 48, + ), + }, + Token { + sgr: ColorDefaultForeground, + range: ( + 48, + 53, + ), + }, ], ) diff --git a/ansi2/src/svg.rs b/ansi2/src/svg.rs index b7d4a20..42e62a3 100644 --- a/ansi2/src/svg.rs +++ b/ansi2/src/svg.rs @@ -1,7 +1,7 @@ use crate::{ + canvas::Canvas, css::{CssType, Mode, NodeStyle, Style}, theme::ColorTable, - Canvas, }; #[allow(clippy::too_many_arguments)] pub fn to_svg, T: ColorTable>( @@ -14,6 +14,7 @@ pub fn to_svg, T: ColorTable>( dark_bg: Option, font_size: Option, length_adjust: Option, + sourcemap: bool, ) -> String { let font_size = font_size.unwrap_or(16); let s = str.as_ref(); @@ -96,6 +97,20 @@ pub fn to_svg, T: ColorTable>( text_class.push(NodeStyle::Hide.class_name().to_string()); style.hide = true; } + + if sourcemap { + text_class.push(format!("text:{}:{}", c.text_r.0, c.text_r.1)); + text_class.push(format!("color:{}:{}", c.color_r.0, c.color_r.1)); + text_class.push(format!("bg:{}:{}", c.bg_color_r.0, c.bg_color_r.1)); + text_class.push(format!("bold:{}:{}", c.bold_r.0, c.bold_r.1)); + text_class.push(format!("blink:{}:{}", c.blink_r.0, c.blink_r.1)); + text_class.push(format!("dim:{}:{}", c.dim_r.0, c.dim_r.1)); + text_class.push(format!("italic:{}:{}", c.italic_r.0, c.italic_r.1)); + text_class.push(format!("underline:{}:{}", c.underline_r.0, c.underline_r.1)); + text_class.push(format!("hide:{}:{}", c.hide_r.0, c.hide_r.1)); + text_class.push(format!("strike:{}:{}", c.strike_r.0, c.strike_r.1)); + } + let class_str = if text_class.is_empty() { String::new() } else { diff --git a/ansi2/src/text.rs b/ansi2/src/text.rs index 5a68752..386599e 100644 --- a/ansi2/src/text.rs +++ b/ansi2/src/text.rs @@ -1,4 +1,4 @@ -use crate::Canvas; +use crate::canvas::Canvas; pub fn to_text>(str: S, width: Option) -> String { let s = str.as_ref(); diff --git a/assets/changelog/0.2.12.md b/assets/changelog/0.2.12.md index 8e0db56..8eae418 100644 --- a/assets/changelog/0.2.12.md +++ b/assets/changelog/0.2.12.md @@ -13,6 +13,10 @@ Through this two optimization methods, the size has been reduced to about one-fi -rw-r--r-- 1 ace None 25K Oct 24 19:37 vitest.svg ``` +## sourcemap + +Add the source of all styles of node to the class field + ## Config Added two new parameters diff --git a/readme.md b/readme.md index 3e48030..b0b78c5 100644 --- a/readme.md +++ b/readme.md @@ -117,6 +117,19 @@ neofetch | ansi2 --format=svg --length-adjust=spacingAndGlyphs > neofetch.svg neofetch | ansi2 --format=svg --length-adjust="" > neofetch.svg ``` +### sourcemap + + +Add data to the class field of the corresponding pixel in the html/svg file + +```text:10:20``` means the text comes from characters 10 to 20 of the ans file + + +```bash +neofetch | ansi2 --format=svg -s > neofetch.svg +``` + + ## example ### neofetch