aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-12-19 16:09:47 -0800
committerKaz Kylheku <kaz@kylheku.com>2024-12-19 16:09:47 -0800
commit7fbdc5a088c37bd24da5954474a189cd4c890dce (patch)
tree871381d6715e5e179f195d8a02f5a7e2d99a3e02
parent83638902f7d4ecfefe959732409e7db40d429e00 (diff)
downloadbasta-7fbdc5a088c37bd24da5954474a189cd4c890dce.tar.gz
basta-7fbdc5a088c37bd24da5954474a189cd4c890dce.tar.bz2
basta-7fbdc5a088c37bd24da5954474a189cd4c890dce.zip
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.
-rw-r--r--basta.sh8
1 files 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()