From 8ae916ddfbba2388f19dcedd1052546868587138 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 1 Feb 2024 19:47:44 -0800 Subject: mcd: scroll-region-friendly line clearing. * cdlog.sh (cdlog.mcd): Going up ten lines with \e[10A and then clearing to the end of screen with \e[J is unfriendly when the user has a scroll-protected region at the bottom showing a status line. Instead, let us go up one line at a time ten times with \e[A, and clear each line to end of line with \e[K. --- cdlog.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cdlog.sh b/cdlog.sh index e26f374..087f454 100644 --- a/cdlog.sh +++ b/cdlog.sh @@ -120,6 +120,7 @@ cdlog.mcd() local sel= local swap= local res=1 + local i local d=("" "$c1" "$c2" "$c3" "$c4" "$c5" "$c6" "$c7" "$c8" "$c9") if [ $# -gt 0 ] && [ "$1" = -s ] ; then @@ -132,7 +133,9 @@ cdlog.mcd() read -p "? " sel - printf "\e[10A\e[J" + for i in {1..10}; do + printf "\e[A\e[K" + done case "$sel" in ( [1-9] ) -- cgit v1.2.3