From 445a88a7e6718a51eb1ca1460af95a29f4ebf9fe Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 14 Oct 2023 21:28:07 +0200 Subject: [PATCH 1/5] Print newline after completed progress bar --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index c77d779..d22e315 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -188,6 +188,7 @@ pub fn run(input: I, output: O, config: Config) -> let mut pr = gifski::progress::ProgressBar::new(count); let result = writer.write(output, &mut pr); pr.finish(); + println!(); result } else { let mut pr = gifski::progress::NoProgress {}; From ccc29815692f0d977bba5c60c94366abd1236df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=91=86=20Neveda=20=E2=91=88?= <63655535+Neved4@users.noreply.github.com> Date: Sat, 14 Oct 2023 13:34:19 +0200 Subject: [PATCH 2/5] Add Nord theme --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d22e315..fe31646 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,6 +72,7 @@ pub enum Theme { #[default] Dracula, Monokai, + Nord, SolarizedDark, SolarizedLight, @@ -91,6 +92,7 @@ impl TryFrom for theme::Theme { Asciinema => "121314,cccccc,000000,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,d9d9d9,4d4d4d,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,ffffff".parse(), Dracula => "282a36,f8f8f2,21222c,ff5555,50fa7b,f1fa8c,bd93f9,ff79c6,8be9fd,f8f8f2,6272a4,ff6e6e,69ff94,ffffa5,d6acff,ff92df,a4ffff,ffffff".parse(), Monokai => "272822,f8f8f2,272822,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f8f8f2,75715e,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f9f8f5".parse(), + Nord => "2e3440,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4".parse(), SolarizedDark => "002b36,839496,073642,dc322f,859900,b58900,268bd2,d33682,2aa198,eee8d5,002b36,cb4b16,586e75,657b83,839496,6c71c4,93a1a1,fdf6e3".parse(), SolarizedLight => "fdf6e3,657b83,073642,dc322f,859900,b58900,268bd2,d33682,2aa198,eee8d5,002b36,cb4b16,586e75,657c83,839496,6c71c4,93a1a1,fdf6e3".parse(), Custom(t) => t.parse(), From d7cca5523605a853ac0cdd2a98f87d0c47ddb5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=91=86=20Neveda=20=E2=91=88?= <63655535+Neved4@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:43:45 +0200 Subject: [PATCH 3/5] Add Github Dark and Light themes --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index fe31646..f48ca7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,6 +71,8 @@ pub enum Theme { Asciinema, #[default] Dracula, + GithubDark, + GithubLight, Monokai, Nord, SolarizedDark, @@ -91,6 +93,8 @@ impl TryFrom for theme::Theme { match theme { Asciinema => "121314,cccccc,000000,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,d9d9d9,4d4d4d,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,ffffff".parse(), Dracula => "282a36,f8f8f2,21222c,ff5555,50fa7b,f1fa8c,bd93f9,ff79c6,8be9fd,f8f8f2,6272a4,ff6e6e,69ff94,ffffa5,d6acff,ff92df,a4ffff,ffffff".parse(), + GithubDark => "202327,eceff4,6a737d,f97583,a2fca2,fabb72,7db4f9,c4a0f5,1f6feb,6a737d".parse(), + GithubLight => "eceff4,202327,6a737d,f97583,a2fca2,fabb72,7db4f9,c4a0f5,1f6feb,6a737d".parse(), Monokai => "272822,f8f8f2,272822,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f8f8f2,75715e,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f9f8f5".parse(), Nord => "2e3440,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4".parse(), SolarizedDark => "002b36,839496,073642,dc322f,859900,b58900,268bd2,d33682,2aa198,eee8d5,002b36,cb4b16,586e75,657b83,839496,6c71c4,93a1a1,fdf6e3".parse(), From f10741fdf04f7a2b2474cd2c657973f20c036b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=91=86=20Neveda=20=E2=91=88?= <63655535+Neved4@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:42:34 +0200 Subject: [PATCH 4/5] Enhance GitHub Dark background color --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f48ca7b..832852f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,7 +93,7 @@ impl TryFrom for theme::Theme { match theme { Asciinema => "121314,cccccc,000000,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,d9d9d9,4d4d4d,dd3c69,4ebf22,ddaf3c,26b0d7,b954e1,54e1b9,ffffff".parse(), Dracula => "282a36,f8f8f2,21222c,ff5555,50fa7b,f1fa8c,bd93f9,ff79c6,8be9fd,f8f8f2,6272a4,ff6e6e,69ff94,ffffa5,d6acff,ff92df,a4ffff,ffffff".parse(), - GithubDark => "202327,eceff4,6a737d,f97583,a2fca2,fabb72,7db4f9,c4a0f5,1f6feb,6a737d".parse(), + GithubDark => "171b21,eceff4,6a737d,f97583,a2fca2,fabb72,7db4f9,c4a0f5,1f6feb,6a737d".parse(), GithubLight => "eceff4,202327,6a737d,f97583,a2fca2,fabb72,7db4f9,c4a0f5,1f6feb,6a737d".parse(), Monokai => "272822,f8f8f2,272822,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f8f8f2,75715e,f92672,a6e22e,f4bf75,66d9ef,ae81ff,a1efe4,f9f8f5".parse(), Nord => "2e3440,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4,3b4252,bf616a,a3be8c,ebcb8b,81a1c1,b48ead,88c0d0,eceff4".parse(), From 7aa2720ce8f06d31913f00d643201a3a9a797705 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 14 Oct 2023 23:02:37 +0200 Subject: [PATCH 5/5] Update avt to latest version --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/vt.rs | 16 ++++++---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7a6bb5..f19ca3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,8 +152,8 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "avt" -version = "0.8.2" -source = "git+https://github.com/asciinema/avt.git?tag=v0.8.2#e0f424801e9b9ae87977131d87d947c87a004e9b" +version = "0.8.3" +source = "git+https://github.com/asciinema/avt.git?tag=v0.8.3#28aed2b5a65a4ff07344fd6bc51b8ccb8542389c" dependencies = [ "rgb", "serde", diff --git a/Cargo.toml b/Cargo.toml index 730eff9..197f850 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1" -avt = { git = "https://github.com/asciinema/avt.git", tag = "v0.8.2" } +avt = { git = "https://github.com/asciinema/avt.git", tag = "v0.8.3" } clap = { version = "3.2.15", features = ["derive"] } env_logger = "0.10" fontdb = "0.10" diff --git a/src/vt.rs b/src/vt.rs index d342d5e..6226433 100644 --- a/src/vt.rs +++ b/src/vt.rs @@ -4,12 +4,16 @@ pub fn frames( stdout: impl Iterator, terminal_size: (usize, usize), ) -> impl Iterator>, Option<(usize, usize)>)> { - let mut vt = avt::Vt::new(terminal_size.0, terminal_size.1); + let mut vt = avt::Vt::builder() + .size(terminal_size.0, terminal_size.1) + .scrollback_limit(0) + .build(); + let mut prev_cursor = None; stdout.filter_map(move |(time, data)| { let (changed_lines, _) = vt.feed_str(&data); - let cursor = cursor_option(vt.cursor()); + let cursor: Option<(usize, usize)> = vt.cursor().into(); if !changed_lines.is_empty() || cursor != prev_cursor { prev_cursor = cursor; @@ -30,14 +34,6 @@ pub fn frames( }) } -fn cursor_option((col, row, visible): (usize, usize, bool)) -> Option<(usize, usize)> { - if visible { - Some((col, row)) - } else { - None - } -} - #[cfg(test)] mod tests { #[test]