Clearing the terminal is now a config option and launch flag instead of being hardcoded. '--clear on/off' or ''
This commit is contained in:
parent
f8ef1b93c7
commit
9266678368
|
@ -183,6 +183,8 @@ Once you set the var the script will scale the image and padding
|
||||||
--scrotcmd Screenshot program to launch
|
--scrotcmd Screenshot program to launch
|
||||||
|
|
||||||
Other:
|
Other:
|
||||||
|
--clear on/off Whether or not to clear the terminal
|
||||||
|
before printing.
|
||||||
--help Print this text and exit
|
--help Print this text and exit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
16
fetch
16
fetch
|
@ -227,6 +227,11 @@ xoffset=0
|
||||||
# Other Options {{{
|
# Other Options {{{
|
||||||
|
|
||||||
|
|
||||||
|
# Clear terminal before printing?
|
||||||
|
# Needs to be on for images to work
|
||||||
|
# --clear on/off
|
||||||
|
clear_terminal="on"
|
||||||
|
|
||||||
# Take a screenshot
|
# Take a screenshot
|
||||||
# --scrot on/off
|
# --scrot on/off
|
||||||
scrot="off"
|
scrot="off"
|
||||||
|
@ -947,6 +952,8 @@ usage () { cat << EOF
|
||||||
--scrotcmd Screenshot program to launch
|
--scrotcmd Screenshot program to launch
|
||||||
|
|
||||||
Other:
|
Other:
|
||||||
|
--clear on/off Whether or not to clear the terminal
|
||||||
|
before printing.
|
||||||
--help Print this text and exit
|
--help Print this text and exit
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1025,6 +1032,7 @@ while [ "$1" ]; do
|
||||||
--scrotcmd) scrot="$2" ;;
|
--scrotcmd) scrot="$2" ;;
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
|
--clear) clear_terminal="$2" ;;
|
||||||
--help) usage ;;
|
--help) usage ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1122,10 +1130,10 @@ termsize=${termsize/$'\n'/ }
|
||||||
lines=${termsize% *}
|
lines=${termsize% *}
|
||||||
columns=${termsize#* }
|
columns=${termsize#* }
|
||||||
|
|
||||||
if [ "$image" != "off" ]; then
|
[ "$image" != "off" ] && getimage
|
||||||
getimage
|
|
||||||
|
|
||||||
# Clear the terminal and hide the cursor
|
# Clear the terminal and hide the cursor
|
||||||
|
if [ "$clear_terminal" == "on" ]; then
|
||||||
clear
|
clear
|
||||||
printf "\e[?25l"
|
printf "\e[?25l"
|
||||||
fi
|
fi
|
||||||
|
@ -1138,13 +1146,13 @@ colors
|
||||||
bold
|
bold
|
||||||
printinfo
|
printinfo
|
||||||
|
|
||||||
if [ "$image" != "off" ]; then
|
[ "$image" != "off" ] && \
|
||||||
printf "%b%s" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
printf "%b%s" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
||||||
$w3m_img_path
|
$w3m_img_path
|
||||||
|
|
||||||
# Move cursor to bottom and redisplay it.
|
# Move cursor to bottom and redisplay it.
|
||||||
|
[ "$clear_terminal" == "on" ] && \
|
||||||
printf "%b%s" "\e[${lines}H\e[${prompt_height}A\e[?25h"
|
printf "%b%s" "\e[${lines}H\e[${prompt_height}A\e[?25h"
|
||||||
fi
|
|
||||||
|
|
||||||
# Enable line wrap again
|
# Enable line wrap again
|
||||||
[ "$line_wrap" == "off" ] && printf '\e[?7h'
|
[ "$line_wrap" == "off" ] && printf '\e[?7h'
|
||||||
|
|
Reference in New Issue