From 50f7e8a1bc95ef8802a7cf31bcdb03256f08a303 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 27 Dec 2023 23:28:49 +0000 Subject: do not use tput --- typr.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'typr.sh') diff --git a/typr.sh b/typr.sh index 1a4c838..e35dc86 100755 --- a/typr.sh +++ b/typr.sh @@ -6,7 +6,7 @@ entered_text="" text="" tty_init () { - tput clear + printf "" export SAVED_TTY_SETTINGS=$(stty -g) stty raw -echo trap typr_cleanup 1 2 3 6 @@ -15,10 +15,8 @@ tty_init () { } tty_cleanup () { - tput clear - tput cnorm stty $SAVED_TTY_SETTINGS - + printf "[?25h" } tty_readc () { @@ -87,8 +85,7 @@ typr_draw_text () { i=$((i+1)) done - printf "%s[${cpos}H" "$draw" - tput cnorm + printf "%s[${cpos}H[?25h" "$draw" } typr_get_time () { @@ -111,8 +108,7 @@ typr_calculate_wpm () { } typr_show_results () { - tput clear - tput civis + printf "[?25l" now="$(date +%s%N)" time_ns=$((now-start)) @@ -215,8 +211,9 @@ typr_main () { } typr_init () { - cols="$(tput cols)" - lines="$(tput lines)" + set -- $(stty size) + cols="$2" + lines="$1" areax=$((cols / 3)) areay=$((lines / 3)) -- cgit v1.2.1