general: Swap sequences from \033 to \e
This commit is contained in:
parent
f2300d3306
commit
8c277ac74a
60
neofetch
60
neofetch
|
@ -27,7 +27,7 @@ export PATH="/usr/xpg4/bin:/usr/sbin:/sbin:/usr/etc:/usr/libexec:${PATH}"
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
|
||||||
# Reset colors and bold.
|
# Reset colors and bold.
|
||||||
reset="\033[0m"
|
reset="\\e[0m"
|
||||||
|
|
||||||
# DETECT INFORMATION
|
# DETECT INFORMATION
|
||||||
|
|
||||||
|
@ -2356,9 +2356,9 @@ get_cols() {
|
||||||
# Generate the string.
|
# Generate the string.
|
||||||
for ((start; start<=end; start++)); do
|
for ((start; start<=end; start++)); do
|
||||||
case "$start" in
|
case "$start" in
|
||||||
[0-6]) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
|
[0-6]) blocks+="${reset}\\e[3${start}m\\e[4${start}m${block_width}" ;;
|
||||||
7) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
|
7) blocks+="${reset}\\e[3${start}m\\e[4${start}m${block_width}" ;;
|
||||||
*) blocks2+="\033[38;5;${start}m\033[48;5;${start}m${block_width}" ;;
|
*) blocks2+="\\e[38;5;${start}m\\e[48;5;${start}m${block_width}" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -2371,12 +2371,12 @@ get_cols() {
|
||||||
|
|
||||||
# Add newlines to the string.
|
# Add newlines to the string.
|
||||||
cols="${cols%%'nl'}"
|
cols="${cols%%'nl'}"
|
||||||
cols="${cols//nl/\\n\\033[${text_padding}C${zws}}"
|
cols="${cols//nl/\\n\\\e[${text_padding}C${zws}}"
|
||||||
|
|
||||||
# Add block height to info height.
|
# Add block height to info height.
|
||||||
info_height="$((info_height+=block_height+2))"
|
info_height="$((info_height+=block_height+2))"
|
||||||
|
|
||||||
printf "%b\n" "\033[${text_padding}C${zws}${cols}"
|
printf "%b\n" "\\e[${text_padding}C${zws}${cols}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset -v blocks blocks2 cols
|
unset -v blocks blocks2 cols
|
||||||
|
@ -2433,7 +2433,7 @@ image_backend() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Set cursor position next image/ascii.
|
# Set cursor position next image/ascii.
|
||||||
[[ "$image_backend" != "off" ]] && printf "%b" "\033[${lines:-0}A\033[9999999D"
|
[[ "$image_backend" != "off" ]] && printf "%b" "\\e[${lines:-0}A\\e[9999999D"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ascii() {
|
get_ascii() {
|
||||||
|
@ -2621,14 +2621,14 @@ get_term_size() {
|
||||||
# so we have to use a slightly different sequence to
|
# so we have to use a slightly different sequence to
|
||||||
# get the terminal size.
|
# get the terminal size.
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
printf "%b" "\033Ptmux;\033\033[14t\033\033[c\033\\"
|
printf "%b" "\\ePtmux;\\e\\e[14t\\e\\e[c\\e\\"
|
||||||
read_flags=(-d c)
|
read_flags=(-d c)
|
||||||
|
|
||||||
elif [[ "$image_backend" == "tycat" ]]; then
|
elif [[ "$image_backend" == "tycat" ]]; then
|
||||||
printf "%b" "\033}qs\000"
|
printf "%b" "\\e}qs\000"
|
||||||
|
|
||||||
else
|
else
|
||||||
printf "%b" "\033[14t\033[c"
|
printf "%b" "\\e[14t\\e[c"
|
||||||
read_flags=(-d c)
|
read_flags=(-d c)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2647,7 +2647,7 @@ get_term_size() {
|
||||||
term_width="${term_size[2]/t*}"
|
term_width="${term_size[2]/t*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get terminal width/height if \033[14t is unsupported.
|
# Get terminal width/height if \\e[14t is unsupported.
|
||||||
if [[ -z "$term_width" ]] || (( "$term_width" < 50 )); then
|
if [[ -z "$term_width" ]] || (( "$term_width" < 50 )); then
|
||||||
if type -p xdotool >/dev/null 2>&1; then
|
if type -p xdotool >/dev/null 2>&1; then
|
||||||
current_window="$(xdotool getactivewindow)"
|
current_window="$(xdotool getactivewindow)"
|
||||||
|
@ -2845,10 +2845,10 @@ display_image() {
|
||||||
|
|
||||||
"iterm2")
|
"iterm2")
|
||||||
image="$(base64 < "$image")"
|
image="$(base64 < "$image")"
|
||||||
iterm_cmd="\033]1337;File=width=${width}px;height=${height}px;inline=1:${image}"
|
iterm_cmd="\\e]1337;File=width=${width}px;height=${height}px;inline=1:${image}"
|
||||||
|
|
||||||
# Tmux requires an additional escape sequence for this to work.
|
# Tmux requires an additional escape sequence for this to work.
|
||||||
[[ -n "$TMUX" ]] && iterm_cmd="\033Ptmux;\033${iterm_cmd}\033\\"
|
[[ -n "$TMUX" ]] && iterm_cmd="\\ePtmux;\\e${iterm_cmd}\\e\\"
|
||||||
|
|
||||||
printf "%b\a\n" "$iterm_cmd"
|
printf "%b\a\n" "$iterm_cmd"
|
||||||
;;
|
;;
|
||||||
|
@ -2884,7 +2884,7 @@ to_ascii() {
|
||||||
get_ascii
|
get_ascii
|
||||||
|
|
||||||
# Set cursor position next image/ascii.
|
# Set cursor position next image/ascii.
|
||||||
printf "%b" "\033[${lines:-0}A\033[9999999D"
|
printf "%b" "\\e[${lines:-0}A\\e[9999999D"
|
||||||
}
|
}
|
||||||
|
|
||||||
to_off() {
|
to_off() {
|
||||||
|
@ -3044,7 +3044,7 @@ prin() {
|
||||||
string="${2:-$1}"
|
string="${2:-$1}"
|
||||||
local subtitle_color="$info_color"
|
local subtitle_color="$info_color"
|
||||||
fi
|
fi
|
||||||
string="$(trim "${string//$'\033[0m'}")"
|
string="$(trim "${string//$'\\e[0m'}")"
|
||||||
|
|
||||||
# Log length if it doesn't exist.
|
# Log length if it doesn't exist.
|
||||||
if [[ -z "$length" ]]; then
|
if [[ -z "$length" ]]; then
|
||||||
|
@ -3057,7 +3057,7 @@ prin() {
|
||||||
string="${subtitle_color}${bold}${string}"
|
string="${subtitle_color}${bold}${string}"
|
||||||
|
|
||||||
# Print the info.
|
# Print the info.
|
||||||
printf "%b\n" "${text_padding:+\033[${text_padding}C}${zws}${string}${reset} "
|
printf "%b\n" "${text_padding:+\\e[${text_padding}C}${zws}${string}${reset} "
|
||||||
|
|
||||||
# Calculate info height.
|
# Calculate info height.
|
||||||
((++info_height))
|
((++info_height))
|
||||||
|
@ -3069,7 +3069,7 @@ prin() {
|
||||||
get_underline() {
|
get_underline() {
|
||||||
if [[ "$underline_enabled" == "on" ]]; then
|
if [[ "$underline_enabled" == "on" ]]; then
|
||||||
printf -v underline "%${length}s"
|
printf -v underline "%${length}s"
|
||||||
printf "%b%b\n" "${text_padding:+\033[${text_padding}C}${zws}${underline_color}" \
|
printf "%b%b\n" "${text_padding:+\\e[${text_padding}C}${zws}${underline_color}" \
|
||||||
"${underline// /$underline_char}${reset} "
|
"${underline// /$underline_char}${reset} "
|
||||||
unset -v length
|
unset -v length
|
||||||
fi
|
fi
|
||||||
|
@ -3090,12 +3090,12 @@ get_line_break() {
|
||||||
|
|
||||||
get_bold() {
|
get_bold() {
|
||||||
case "$ascii_bold" in
|
case "$ascii_bold" in
|
||||||
"on") ascii_bold="\033[1m" ;;
|
"on") ascii_bold="\\e[1m" ;;
|
||||||
"off") ascii_bold="" ;;
|
"off") ascii_bold="" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$bold" in
|
case "$bold" in
|
||||||
"on") bold="\033[1m" ;;
|
"on") bold="\\e[1m" ;;
|
||||||
"off") bold="" ;;
|
"off") bold="" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -3124,10 +3124,10 @@ trim_quotes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
strip_sequences() {
|
strip_sequences() {
|
||||||
strip="${1//$'\033['3[0-9]m}"
|
strip="${1//$'\\e['3[0-9]m}"
|
||||||
strip="${strip//$'\033['38\;5\;[0-9]m}"
|
strip="${strip//$'\\e['38\;5\;[0-9]m}"
|
||||||
strip="${strip//$'\033['38\;5\;[0-9][0-9]m}"
|
strip="${strip//$'\\e['38\;5\;[0-9][0-9]m}"
|
||||||
strip="${strip//$'\033['38\;5\;[0-9][0-9][0-9]m}"
|
strip="${strip//$'\\e['38\;5\;[0-9][0-9][0-9]m}"
|
||||||
|
|
||||||
printf "%s\n" "$strip"
|
printf "%s\n" "$strip"
|
||||||
}
|
}
|
||||||
|
@ -3926,9 +3926,9 @@ set_text_colors() {
|
||||||
|
|
||||||
color() {
|
color() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
[0-6]) printf "%b" "${reset}\033[3${1}m" ;;
|
[0-6]) printf "%b" "${reset}\\e[3${1}m" ;;
|
||||||
7 | "fg") printf "%b" "\033[37m${reset}" ;;
|
7 | "fg") printf "%b" "\\e[37m${reset}" ;;
|
||||||
*) printf "%b" "\033[38;5;${1}m" ;;
|
*) printf "%b" "\\e[38;5;${1}m" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3951,7 +3951,7 @@ stdout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
err() {
|
err() {
|
||||||
err+="$(color 1)[!]\033[0m $1\n"
|
err+="$(color 1)[!]\\e[0m $1\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_full_path() {
|
get_full_path() {
|
||||||
|
@ -4132,7 +4132,7 @@ dynamic_prompt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the prompt location.
|
# Set the prompt location.
|
||||||
((lines > 1)) && printf "%b" "\033[${lines}B"
|
((lines > 1)) && printf "%b" "\\e[${lines}B"
|
||||||
}
|
}
|
||||||
|
|
||||||
old_functions() {
|
old_functions() {
|
||||||
|
@ -4780,10 +4780,10 @@ main() {
|
||||||
# Minix doesn't support these sequences.
|
# Minix doesn't support these sequences.
|
||||||
if [[ "$TERM" != "minix" && "$stdout" != "on" ]]; then
|
if [[ "$TERM" != "minix" && "$stdout" != "on" ]]; then
|
||||||
# If the script exits for any reason, unhide the cursor.
|
# If the script exits for any reason, unhide the cursor.
|
||||||
trap 'printf "\033[?25h\033[?7h"' EXIT
|
trap 'printf "\\e[?25h\\e[?7h"' EXIT
|
||||||
|
|
||||||
# Hide the cursor and disable line wrap.
|
# Hide the cursor and disable line wrap.
|
||||||
printf "\033[?25l\033[?7l"
|
printf "\\e[?25l\\e[?7l"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
image_backend
|
image_backend
|
||||||
|
|
Reference in New Issue