Skip to content

Commit

Permalink
fix fastfetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaoboy committed Sep 17, 2024
1 parent e1665a9 commit dd2394e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ansi2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub mod css;
pub mod html;
pub mod lex;
pub mod svg;
pub mod text;
pub mod theme;
pub mod css;
use lex::{parse_ansi, AnsiColor, Token};

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -134,7 +134,7 @@ impl Canvas {
cur_y = cur_y.saturating_sub(n as usize);
cur_x = 0;
}
Token::CursorHorizontalAbsolute(n) => cur_y = n as usize,
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;
Expand Down Expand Up @@ -240,4 +240,11 @@ mod test {
let r = parse_ansi(s).unwrap();
println!("{:?}", r);
}

#[test]
fn test_fastfetch() {
let s = "";
let r = parse_ansi(s).unwrap();
println!("{:?}", r);
}
}

0 comments on commit dd2394e

Please sign in to comment.