mirror of https://github.com/aristocratos/bashtop
fixed ctrl-z screen repaint and terminal reset
parent
3f687eff63
commit
0cf0f3d86d
38
bashtop
38
bashtop
|
@ -2413,6 +2413,10 @@ menu_() { #? Shows the main menu overlay
|
||||||
local -a menus=("options" "help" "quit") color
|
local -a menus=("options" "help" "quit") color
|
||||||
|
|
||||||
until false; do
|
until false; do
|
||||||
|
|
||||||
|
#* Put program to sleep if caught ctrl-z
|
||||||
|
if ((sleepy==1)); then sleep_; fi
|
||||||
|
|
||||||
draw_clock
|
draw_clock
|
||||||
pause_ menu_pause
|
pause_ menu_pause
|
||||||
unset draw_out
|
unset draw_out
|
||||||
|
@ -2526,6 +2530,10 @@ help_() { #? Shows the help overlay
|
||||||
if [[ -n $pause_screen ]]; then from_menu=1; fi
|
if [[ -n $pause_screen ]]; then from_menu=1; fi
|
||||||
|
|
||||||
until [[ -n $tmp ]]; do
|
until [[ -n $tmp ]]; do
|
||||||
|
|
||||||
|
#* Put program to sleep if caught ctrl-z
|
||||||
|
if ((sleepy==1)); then sleep_; redraw=1; fi
|
||||||
|
|
||||||
if [[ -n $redraw ]]; then
|
if [[ -n $redraw ]]; then
|
||||||
col=$((tty_width/2-36)); line=$((tty_height/2-4)); y=1
|
col=$((tty_width/2-36)); line=$((tty_height/2-4)); y=1
|
||||||
unset redraw help_out
|
unset redraw help_out
|
||||||
|
@ -2548,6 +2556,7 @@ help_() { #? Shows the help overlay
|
||||||
|
|
||||||
get_ms timestamp_end
|
get_ms timestamp_end
|
||||||
time_left=$((timestamp_start+update_ms-timestamp_end))
|
time_left=$((timestamp_start+update_ms-timestamp_end))
|
||||||
|
|
||||||
if ((time_left>1000)); then wait_string=1; time_left=$((time_left-1000))
|
if ((time_left>1000)); then wait_string=1; time_left=$((time_left-1000))
|
||||||
elif ((time_left>0)); then printf -v wait_string ".%03d" "${time_left}"; time_left=0
|
elif ((time_left>0)); then printf -v wait_string ".%03d" "${time_left}"; time_left=0
|
||||||
else wait_string="0.001"; time_left=0; fi
|
else wait_string="0.001"; time_left=0; fi
|
||||||
|
@ -2558,6 +2567,7 @@ help_() { #? Shows the help overlay
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
calc_sizes; draw_bg quiet; redraw=1
|
calc_sizes; draw_bg quiet; redraw=1
|
||||||
d_banner=1
|
d_banner=1
|
||||||
|
unset bannerd menu_out
|
||||||
fi
|
fi
|
||||||
if ((time_left==0)); then get_ms timestamp_start; collect_and_draw; fi
|
if ((time_left==0)); then get_ms timestamp_start; collect_and_draw; fi
|
||||||
if ((resized>0)); then resized=0; fi
|
if ((resized>0)); then resized=0; fi
|
||||||
|
@ -2616,6 +2626,10 @@ options_() { #? Shows the options overlay
|
||||||
if [[ -n $pause_screen ]]; then from_menu=1; fi
|
if [[ -n $pause_screen ]]; then from_menu=1; fi
|
||||||
|
|
||||||
until false; do
|
until false; do
|
||||||
|
|
||||||
|
#* Put program to sleep if caught ctrl-z
|
||||||
|
if ((sleepy==1)); then sleep_; fi
|
||||||
|
|
||||||
draw_clock
|
draw_clock
|
||||||
pause_ options_pause
|
pause_ options_pause
|
||||||
|
|
||||||
|
@ -2786,6 +2800,7 @@ options_() { #? Shows the options overlay
|
||||||
while [[ $size_error == true ]] ; do size_error_msg; done
|
while [[ $size_error == true ]] ; do size_error_msg; done
|
||||||
calc_sizes; draw_bg quiet
|
calc_sizes; draw_bg quiet
|
||||||
redraw_misc=1; time_left=0
|
redraw_misc=1; time_left=0
|
||||||
|
unset options_out bannerd menu_out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((time_left==0)); then get_ms timestamp_start; collect_and_draw; fi
|
if ((time_left==0)); then get_ms timestamp_start; collect_and_draw; fi
|
||||||
|
@ -2804,7 +2819,7 @@ options_() { #? Shows the options overlay
|
||||||
|
|
||||||
get_key() { #? Get one key from standard input and translate key code to readable format
|
get_key() { #? Get one key from standard input and translate key code to readable format
|
||||||
local key key_out wait_time esc ext_out save
|
local key key_out wait_time esc ext_out save
|
||||||
|
|
||||||
until (($#==0)); do
|
until (($#==0)); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-v|-variable) local -n key_out=$2; ext_out=1; shift;; #* Output variable
|
-v|-variable) local -n key_out=$2; ext_out=1; shift;; #* Output variable
|
||||||
|
@ -3043,6 +3058,9 @@ collect_and_draw() { #? Run all collect and draw functions
|
||||||
main_loop() { #? main loop...
|
main_loop() { #? main loop...
|
||||||
local wait_time wait_string
|
local wait_time wait_string
|
||||||
|
|
||||||
|
#* Put program to sleep if caught ctrl-z
|
||||||
|
if ((sleepy==1)); then sleep_; fi
|
||||||
|
|
||||||
#* Timestamp for accurate timer
|
#* Timestamp for accurate timer
|
||||||
get_ms timestamp_start
|
get_ms timestamp_start
|
||||||
|
|
||||||
|
@ -3058,9 +3076,6 @@ main_loop() { #? main loop...
|
||||||
draw_bg
|
draw_bg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#* Put program to sleep if caught ctrl-z
|
|
||||||
if ((sleepy==1)); then sleep_; fi
|
|
||||||
|
|
||||||
#* Run all collect and draw functions
|
#* Run all collect and draw functions
|
||||||
collect_and_draw now
|
collect_and_draw now
|
||||||
|
|
||||||
|
@ -3134,9 +3149,18 @@ resume_() {
|
||||||
stty -echo
|
stty -echo
|
||||||
tput civis
|
tput civis
|
||||||
|
|
||||||
echo -en "${boxes_out}${proc_det}${last_screen}${mem_out}${proc_misc}${proc_misc2}${update_string}${clock_out}"
|
if (( tty_width!=$(tput cols) | tty_height!=$(tput lines) )); then
|
||||||
|
tty_width="$(tput cols)"
|
||||||
resized=1
|
tty_height="$(tput lines)"
|
||||||
|
resized=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $pause_screen ]]; then
|
||||||
|
echo -en "$pause_screen"
|
||||||
|
else
|
||||||
|
echo -en "${boxes_out}${proc_det}${last_screen}${mem_out}${proc_misc}${proc_misc2}${update_string}${clock_out}"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#? Pre main loop
|
#? Pre main loop
|
||||||
|
|
Loading…
Reference in New Issue