From 0070579f79d5699f870a807f825e8eb03b7bcf90 Mon Sep 17 00:00:00 2001 From: Hiers Date: Sat, 17 Feb 2024 18:33:25 +0000 Subject: [PATCH] Fix underflow if executed outside of a terminal. --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index aed68ed..3ffc50d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 */ env::set_var("CLICOLOR_FORCE", "1"); pipe_to_less(&output);