mirror of
https://github.com/tj/n.git
synced 2024-11-29 05:42:48 +01:00
Use tput instead of clear. Closes #196
Thanks to @sameoldmadness for the help!
This commit is contained in:
parent
3a302b7a8b
commit
ad4faa1fd2
31
bin/n
31
bin/n
@ -42,6 +42,30 @@ command -v curl > /dev/null && GET="curl -# -L"
|
||||
|
||||
test -z "$GET" && abort "curl or wget required"
|
||||
|
||||
#
|
||||
# Functions used when showing versions installed
|
||||
#
|
||||
|
||||
enter_fullscreen() {
|
||||
tput smcup
|
||||
stty -echo
|
||||
}
|
||||
|
||||
leave_fullscreen() {
|
||||
tput rmcup
|
||||
stty echo
|
||||
}
|
||||
|
||||
handle_sigint() {
|
||||
leave_fullscreen
|
||||
exit $?
|
||||
}
|
||||
|
||||
handle_sigtstp() {
|
||||
leave_fullscreen
|
||||
kill -s SIGSTOP $$
|
||||
}
|
||||
|
||||
#
|
||||
# Output usage information.
|
||||
#
|
||||
@ -177,10 +201,13 @@ list_versions_installed() {
|
||||
#
|
||||
|
||||
display_versions() {
|
||||
clear
|
||||
enter_fullscreen
|
||||
check_current_version
|
||||
display_versions_with_selected $active
|
||||
|
||||
trap handle_sigint INT
|
||||
trap handle_sigtstp SIGTSTP
|
||||
|
||||
while true; do
|
||||
read -s -n 3 c
|
||||
case "$c" in
|
||||
@ -193,8 +220,8 @@ display_versions() {
|
||||
display_versions_with_selected $(next_version_installed)
|
||||
;;
|
||||
*)
|
||||
clear
|
||||
activate $selected
|
||||
leave_fullscreen
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user