From de4b22ddbf7685fbd4b29f3e30b0dc7a989dad79 Mon Sep 17 00:00:00 2001 From: Nithin Muthukumar <33675303+nithinmuthukumar@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:31:03 -0500 Subject: [PATCH] add check if not on bottom of terminal (#345) --- crates/shrs_line/src/painter.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/shrs_line/src/painter.rs b/crates/shrs_line/src/painter.rs index 19f11c0f..60ab480f 100644 --- a/crates/shrs_line/src/painter.rs +++ b/crates/shrs_line/src/painter.rs @@ -96,7 +96,9 @@ impl Painter { .max(styled_buf_lines.len() - 1 + prompt_left_lines.len() - 1); //make sure num_newlines never gets smaller, and adds newlines to adjust for prompt - if self.num_newlines < total_newlines { + if self.num_newlines < total_newlines + && cursor::position()?.1 + self.num_newlines as u16 == self.term_size.1 - 1 + { self.out .borrow_mut() .queue(ScrollUp((total_newlines - self.num_newlines) as u16))?;