Pager should only capture output from the scope in which it is called.
Consider this scenario:
use pager::Pager;
fn main() {
paged_output();
println!("Unpaged output");
}
fn paged_output() {
Pager::new().setup();
println!("Paged output");
}
Here, we want "Paged output" to be captured by the pager, but not "Unpaged output". We want "Unpaged output" to print to the console after leaving the pager. Ideally, once the Pager
goes out of scope (at the end of paged_output()
), the capture should stop. Or perhaps we have a method for Pager that ends the capture:
fn paged_output() {
let pager = Pager::new();
pager.setup(); // Start capturing
println!("Paged output");
pager.end(); // Stop capturing
}
I don't know how Pager
is currently capturing output, but in the first example, once .setup()
is called, the rest of the program's output is captured by the pager.