aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-02-01 19:47:44 -0800
committerKaz Kylheku <kaz@kylheku.com>2024-02-01 19:47:44 -0800
commit8ae916ddfbba2388f19dcedd1052546868587138 (patch)
tree0d7741ac33ea6098f3ff06e1939bab78585a2c9d
parentf82d1e3322a57d9d137e5a71fd095e38877e62a4 (diff)
downloadcdlog-8ae916ddfbba2388f19dcedd1052546868587138.tar.gz
cdlog-8ae916ddfbba2388f19dcedd1052546868587138.tar.bz2
cdlog-8ae916ddfbba2388f19dcedd1052546868587138.zip
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.
-rw-r--r--cdlog.sh5
1 files changed, 4 insertions, 1 deletions
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] )