You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use bat::PrettyPrinter;let targets:(PathBuf,Vec<(usize,usize)>) = vec![];letmut pp = PrettyPrinter::new();for(path, ranges)in targets.iter(){
pp.input_file(path);for(start, end)in ranges.iter(){
pp.highlight_range(*start,*end);}// This clears inputs, but does not clear highlights
pp.print().unwrap();}
Since there are multiple files with different highlight ranges, I want to print each files with different ranges. However, currently there is no way to clear highlights in bat::PrettyPrinter instance.
Creating bat::PrettyPrinter instance for each file is an option. However it is much slower because bat::PrettyPrinter::new deserializes binary assets and it is time consuming.
What did you expect to happen instead?
I'd like bat::PrettyPrinter to provide some API to clear highlights.
How did you install bat?
[dependencies]
bat = { version = "0.18.3", default-features = false }
in my project's Cargo.toml.
bat version and environment
bat: 0.18.3
OS: macOS 10.15
Rust: 1.56
The text was updated successfully, but these errors were encountered:
Creating bat::PrettyPrinter instance for each file is an option. However it is much slower because bat::PrettyPrinter::new deserializes binary assets and it is time consuming.
Just wanted to add a remark: This should be be much less of a problem now that syntaxes are lazy-loaded.
rhysd
added a commit
to rhysd/bat
that referenced
this issue
Sep 5, 2022
Describe the bug you encountered:
Let's say we have the following code:
Since there are multiple files with different highlight ranges, I want to print each files with different ranges. However, currently there is no way to clear highlights in
bat::PrettyPrinter
instance.Creating
bat::PrettyPrinter
instance for each file is an option. However it is much slower becausebat::PrettyPrinter::new
deserializes binary assets and it is time consuming.What did you expect to happen instead?
I'd like
bat::PrettyPrinter
to provide some API to clear highlights.How did you install
bat
?in my project's
Cargo.toml
.bat version and environment
The text was updated successfully, but these errors were encountered: