aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-02-13 23:41:20 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-02-13 23:41:20 -0800
commit62c92629b40ea907c5cc6f69001e2fecdfa66b88 (patch)
tree5ebe77fce6ca54120a4611e917b8a42895f2066f
parentb90bab875ca8cf125040b7c3b894babd337ec2e7 (diff)
downloadbasta-62c92629b40ea907c5cc6f69001e2fecdfa66b88.tar.gz
basta-62c92629b40ea907c5cc6f69001e2fecdfa66b88.tar.bz2
basta-62c92629b40ea907c5cc6f69001e2fecdfa66b88.zip
prepare_term: account for all status lines.
* basta.sh (basta.prepare_term): The old logic of printing \n ESC [ A (newline, go up one line) is inadequate when we have multiple previous status lines to draw. It only works if the previous status lines can be counted on to be already scroll-protected. We need to print as many new lines as we have status lines, and then move the cursor up that many lines. Also, before doing this, we reset the scrolling region to the full size. This same logic could simplify basta.fullscreen_alt.
-rw-r--r--basta.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/basta.sh b/basta.sh
index d0afc20..5707e0e 100644
--- a/basta.sh
+++ b/basta.sh
@@ -39,6 +39,7 @@ basta.query_termios_lines_cols()
basta.prepare_term()
{
local realrows
+ local i
if ! basta.query_terminal_lines realrows; then
return 1
@@ -46,7 +47,11 @@ basta.prepare_term()
if [ -z "$basta_prev_reserved_rows" ] ; then
basta_prev_reserved_rows=${#LC_basta_status[@]}
- printf $'\n\e[A'
+ printf $'\e7\e[1;%sr\e8' $realrows
+ for (( i = 0; i <= basta_prev_reserved_rows; i++ )); do
+ printf $'\n'
+ done
+ printf $'\e[%sA' $i
fi
LINES=$((realrows - $basta_prev_reserved_rows - 1))