diff options
-rw-r--r-- | basta.sh | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -356,15 +356,21 @@ basta.fullscreen_alt() { basta_deferred_intr=WINCH LINES=$realrows command "$@" || exit=$? + local scrolls_needed=$basta_prev_reserved_rows + if basta.query_terminal_lines realrows >&$ttyfd <&$ttyfd && - basta.get_cur_line curline >&$ttyfd <&$ttyfd && - [ $curline -ge $(( realrows - basta_prev_reserved_rows )) ] + basta.get_cur_line curline >&$ttyfd <&$ttyfd then - local scrolls_needed=$(( curline - realrows + basta_prev_reserved_rows )) + : $(( scrolls_needed -= realrows - curline )) + fi + + if [ $scrolls_needed -gt 0 ] ; then printf $'\e[%s;1H' $realrows >&$ttyfd + for (( i = 0 ; i < scrolls_needed; i++ )) ; do printf $'\n' >&$ttyfd done + printf $'\n\e[%sA' $(( basta_prev_reserved_rows + 1 )) >&$ttyfd fi |