From 11d4748688e1dc4c95d5f5490121692094218215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 15 Dec 2022 22:50:17 +0100 Subject: [PATCH] Try to reduce flickering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- padd.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/padd.sh b/padd.sh index 8dacef4b..e1bc6769 100755 --- a/padd.sh +++ b/padd.sh @@ -684,13 +684,8 @@ PrintLogo() { } PrintDashboard() { - # Clear the screen and move cursor to (0,0). - # This mimics the 'clear' command. - # https://vt100.net/docs/vt510-rm/ED.html - # https://vt100.net/docs/vt510-rm/CUP.html - # E3 extension `\e[3J` to clear the scrollback buffer (see 'man clear') - - printf '\e[H\e[2J\e[3J' + # Move cursor to (0,0). + printf '\e[H' # adds the y-offset moveYOffset @@ -932,8 +927,8 @@ SizeChecker(){ # this reduces "flickering" of GenerateSizeDependendOutput() items # after a terminal re-size sleep 0.1 - console_height=$(stty size | awk '{ print $1 }') - console_width=$(stty size | awk '{ print $2 }') + console_width=$(tput cols) + console_height=$(tput lines) # Mega if [ "$console_width" -ge "80" ] && [ "$console_height" -ge "26" ]; then @@ -1259,6 +1254,15 @@ TerminalResize(){ # kill the sleep function within NormalPADD() to trigger redrawing # of the Dashboard SizeChecker + + # Clear the screen and move cursor to (0,0). + # This mimics the 'clear' command. + # https://vt100.net/docs/vt510-rm/ED.html + # https://vt100.net/docs/vt510-rm/CUP.html + # E3 extension `\e[3J` to clear the scrollback buffer (see 'man clear') + + printf '\e[H\e[2J\e[3J' + kill $sleepPID > /dev/null 2>&1 }