Lots of misc changes
This commit is contained in:
parent
6c20e2c5d5
commit
d4bd2b3d5e
1 changed files with 18 additions and 15 deletions
31
fetch
31
fetch
|
@ -2111,13 +2111,15 @@ done
|
||||||
# Restore cursor and clear screen on ctrl+c
|
# Restore cursor and clear screen on ctrl+c
|
||||||
trap 'printf "\033[?25h"; clear; exit' 2
|
trap 'printf "\033[?25h"; clear; exit' 2
|
||||||
|
|
||||||
|
# If the script exits for any reason, unhide the cursor.
|
||||||
|
trap 'printf "\033[?25h"' EXIT
|
||||||
|
|
||||||
# Get columns
|
# Get columns
|
||||||
columns=$(tput cols)
|
columns=$(tput cols)
|
||||||
|
|
||||||
|
if [ "$image" != "off" ]; then
|
||||||
# Hide the cursor
|
# Hide the cursor
|
||||||
printf "\033[?25l"
|
printf "\033[?25l"
|
||||||
|
|
||||||
if [ "$image" != "off" ]; then
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
# Find w3mimgdisplay
|
# Find w3mimgdisplay
|
||||||
|
@ -2127,11 +2129,8 @@ if [ "$image" != "off" ]; then
|
||||||
getimage
|
getimage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable line wrap
|
|
||||||
[ "$line_wrap" == "off" ] && printf "\033[?7l"
|
|
||||||
|
|
||||||
# Display the image if enabled
|
# Display the image if enabled
|
||||||
if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then
|
if [ "$image" != "off" ] || [ "$image" != "ascii" ]; then
|
||||||
case "$image_backend" in
|
case "$image_backend" in
|
||||||
"w3m")
|
"w3m")
|
||||||
printf "%b%s\n" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
printf "%b%s\n" "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
||||||
|
@ -2144,27 +2143,31 @@ if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Disable line wrap
|
||||||
|
[ "$line_wrap" == "off" ] && printf "\033[?7l"
|
||||||
|
|
||||||
|
# Move cursor to the top
|
||||||
|
[ "$image" != "off" ] && printf "\033[0H"
|
||||||
|
|
||||||
# Get colors / bold
|
# Get colors / bold
|
||||||
colors
|
colors
|
||||||
bold
|
bold
|
||||||
|
|
||||||
# Move the cursor to the top and display the info
|
# Print the info
|
||||||
[ "$image" != "off" ] && printf "\033[0H"
|
|
||||||
printinfo
|
printinfo
|
||||||
|
|
||||||
# Set cursor position dynamically based on height of ascii/text.
|
|
||||||
if [ "$image" != "off" ]; then
|
if [ "$image" != "off" ]; then
|
||||||
|
# Get cursor position
|
||||||
info_height="$(IFS=';' read -srdR -p $'\E[6n' ROW COL; printf "%s" "${ROW#*[}")"
|
info_height="$(IFS=';' read -srdR -p $'\E[6n' ROW COL; printf "%s" "${ROW#*[}")"
|
||||||
|
|
||||||
|
# Set cursor position dynamically based on height of ascii/text.
|
||||||
[ "$lines" -lt "$info_height" ] && lines="$info_height"
|
[ "$lines" -lt "$info_height" ] && lines="$info_height"
|
||||||
|
|
||||||
printf "%b%s" "\033[${lines}H\033[${prompt_height}A"
|
printf "%b%s" "\033[${lines}H\033[${prompt_height}A"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable line wrap again
|
# Show the cursor and re-enable line wrap
|
||||||
[ "$line_wrap" == "off" ] && printf "\033[?7h"
|
printf "%b%s" "\033[?7h\033[?25h"
|
||||||
|
|
||||||
# Show the cursor
|
|
||||||
printf "%b%s" "\033[?25h"
|
|
||||||
|
|
||||||
# If enabled take a screenshot
|
# If enabled take a screenshot
|
||||||
if [ "$scrot" == "on" ]; then
|
if [ "$scrot" == "on" ]; then
|
||||||
|
|
Loading…
Reference in a new issue