Skip to content

Commit

Permalink
Update avt to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Oct 11, 2023
1 parent 2f87b46 commit a9d9e44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
anyhow = "1"
avt = { git = "https://github.com/asciinema/avt.git", tag = "v0.8.0" }
avt = { git = "https://github.com/asciinema/avt.git", tag = "v0.8.2" }
clap = { version = "3.2.15", features = ["derive"] }
env_logger = "0.10"
fontdb = "0.10"
Expand Down
12 changes: 10 additions & 2 deletions src/vt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ pub fn frames(

stdout.filter_map(move |(time, data)| {
let (changed_lines, _) = vt.feed_str(&data);
let cursor = vt.cursor();
let cursor = cursor_option(vt.cursor());

if !changed_lines.is_empty() || cursor != prev_cursor {
prev_cursor = cursor;

let lines = vt
.lines()
.view()
.iter()
.map(|line| line.cells().collect())
.collect();
Expand All @@ -30,6 +30,14 @@ 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]
Expand Down

0 comments on commit a9d9e44

Please sign in to comment.