Fix underflow if executed outside of a terminal.

This commit is contained in:
Hiers 2024-02-17 18:33:25 +00:00
parent eafa2550bb
commit 0070579f79

View file

@ -103,7 +103,7 @@ fn main() -> Result<(), ureq::Error> {
} }
} }
if lines_output >= term_size - 1 && term_size != 0 { if lines_output >= term_size.saturating_sub(1) && term_size != 0 {
/* Output is a different process that is not a tty (i.e. less), but we want to keep colour */ /* Output is a different process that is not a tty (i.e. less), but we want to keep colour */
env::set_var("CLICOLOR_FORCE", "1"); env::set_var("CLICOLOR_FORCE", "1");
pipe_to_less(&output); pipe_to_less(&output);