From 7fbdc5a088c37bd24da5954474a189cd4c890dce Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 19 Dec 2024 16:09:47 -0800 Subject: Streamline code in basta.prepare_term. - We calculate the final LINES value unconditionally whether or not it is the first call that sets basta_prev_reserved_rows. Then we just copy that value into basta_scroll_lines and basta_old_lines. We don't rely on the side effect of the "stty rows" command setting LINES. --- basta.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basta.sh b/basta.sh index ce37890..cec8af5 100644 --- a/basta.sh +++ b/basta.sh @@ -29,14 +29,14 @@ basta.prepare_term() if [ -z "$basta_prev_reserved_rows" ] ; then basta_prev_reserved_rows=$((realrows - LINES)) printf "\n\033[A" - else - LINES=$((realrows - $basta_prev_reserved_rows)) fi - basta_scroll_lines=$((LINES - 1)) - stty rows $basta_scroll_lines + LINES=$((realrows - $basta_prev_reserved_rows - 1)) + + basta_scroll_lines=$LINES basta_old_lines=$LINES basta_old_cols=$COLUMNS + stty rows $LINES } basta.get_cur_line() -- cgit v1.2.3