From 33ec48428c06cecff65f8cfd59798925aacef98b Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 26 Apr 2022 23:38:28 +0100 Subject: added draw area cleaning --- src/xit.sh | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/xit.sh b/src/xit.sh index 9b6ac6c..063c5c3 100644 --- a/src/xit.sh +++ b/src/xit.sh @@ -133,6 +133,16 @@ t_prnt_ptrn () { printf "$@$P" } +t_cls_ptrn () { + local lines=$(tput lines) + tput cup 7 0 + for i in $(seq $((lines-15))); do + tput el + tput cud1 + done + t_drw_ptrn +} + t_drw_ptrn () { local prfx=$1 local flr=$(tput lines) @@ -255,7 +265,7 @@ t_input () { stty $SAVED_TTY_SETTINGS t_msg "$@ - >" > $(tty) +>" > $(tty) t_yes_cur > $(tty) read var echo $var @@ -264,7 +274,7 @@ t_input () { t_tail() { local file=$1 lines=$(tput lines) - t_drw_txt 0 9 "$(tail -$((lines-16)) $1)" + t_drw_txt 0 7 "$(tail -$((lines-14)) $1)" } @@ -273,15 +283,21 @@ t_demo () { t_no_cur t_drw_ptrn "${COLOR_FG}" t_prompt "Hello world?" - file=$(t_input "enter file to tail the end of:") + t_cls_ptrn + name=$(t_input "Enter your name") + t_prompt "Hello $name" + + t_cls_ptrn + + file=./xit.sh [ -f $file ] && { t_tail $file - sleep 10 } || { t_prompt "The file $file does not exist" } + t_prompt "Clear" + t_cls_ptrn t_prompt "Exit?" + t_clean } - - -- cgit v1.2.1