diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-02-13 23:20:31 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-02-13 23:20:31 -0800 |
commit | b90bab875ca8cf125040b7c3b894babd337ec2e7 (patch) | |
tree | 56b39c5606c91dc0ec57dc2fbacaa688ce32cca8 | |
parent | 281628d5b2621cf2f354f633748e6e73e48ef446 (diff) | |
download | basta-b90bab875ca8cf125040b7c3b894babd337ec2e7.tar.gz basta-b90bab875ca8cf125040b7c3b894babd337ec2e7.tar.bz2 basta-b90bab875ca8cf125040b7c3b894babd337ec2e7.zip |
basta.fullscreen_alt: fix off-by-one bug in scroll logic.
* basta.sh (basta.fullscreen_alt): The worst case number of
scrolls needed is basta_prev_reserved_rows + 1, the height of
the status area, not not basta_prev_reserved_rows. Now the [
$scrolls_needed -ge 0 ] test is correct, and we don't we don't
need the extra newline in the final printf. The behavior
is now good in the cases when the command prints zero, one,
two, and three lines.
-rw-r--r-- | basta.sh | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -354,7 +354,7 @@ basta.fullscreen_alt() { basta_deferred_intr=WINCH LINES=$realrows command "$@" || exit=$? - local scrolls_needed=$basta_prev_reserved_rows + local scrolls_needed=$((basta_prev_reserved_rows + 1)) if basta.query_terminal_lines realrows >&$ttyfd <&$ttyfd && basta.get_cur_line curline >&$ttyfd <&$ttyfd @@ -369,7 +369,7 @@ basta.fullscreen_alt() { printf $'\n' >&$ttyfd done - printf $'\n\e[%sA' $(( basta_prev_reserved_rows + 1 )) >&$ttyfd + printf $'\e[%sA' $(( basta_prev_reserved_rows + 1 )) >&$ttyfd fi exec {ttyfd}>&- |