Fixed images disappearing in vte based terminals. Closes #18

This commit is contained in:
Dylan 2016-01-21 13:23:16 +11:00
parent 8fb27be14f
commit 2cd4879fb3
1 changed files with 14 additions and 22 deletions

28
fetch
View File

@ -251,11 +251,6 @@ 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"
@ -1281,8 +1276,6 @@ 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
@ -1363,7 +1356,6 @@ while [ "$1" ]; do
--scrotcmd) scrot="$2" ;; --scrotcmd) scrot="$2" ;;
# Other # Other
--clear) clear_terminal="$2" ;;
--help) usage ;; --help) usage ;;
esac esac
@ -1384,13 +1376,14 @@ trap 'printf "\e[?25h"; clear; exit' 2
lines=$(tput lines) lines=$(tput lines)
columns=$(tput cols) columns=$(tput cols)
[ "$image" != "off" ] && getimage # Clear the terminal
# Clear the terminal and hide the cursor
if [ "$clear_terminal" == "on" ]; then
clear clear
# Hide the cursor
printf "\e[?25l" printf "\e[?25l"
fi
# Get image
[ "$image" != "off" ] && getimage
# Disable line wrap # Disable line wrap
[ "$line_wrap" == "off" ] && printf "\e[?7l" [ "$line_wrap" == "off" ] && printf "\e[?7l"
@ -1417,15 +1410,14 @@ bold
tput cup 0 tput cup 0
printinfo printinfo
# Move cursor to bottom and redisplay it. # Move the cursor to the bottom
if [ "$clear_terminal" == "on" ]; then
case "$os" in case "$os" in
"BSD") tput DO $lines ;; "BSD") tput DO $lines ;;
*) tput cud $lines ;; *) tput cup $lines ;;
esac esac
printf "%b%s" "\e[${prompt_height}A\e[?25h" # Show the cursor
fi printf "\e[?25h"
# Enable line wrap again # Enable line wrap again
[ "$line_wrap" == "off" ] && printf "\e[?7h" [ "$line_wrap" == "off" ] && printf "\e[?7h"