-sh.ch: Remove unneeded quoting #169

This commit is contained in:
Sebastian Gniazdowski 2020-01-15 05:25:55 +01:00
parent ad43154542
commit bd3c6f70fa

View file

@ -14,7 +14,7 @@
(( next_word = 2 | 8192 ))
local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
local __first_call=$1 __wrd=$2 __start_pos=$3 __end_pos=$4
local __style
integer __idx1 __idx2
local -a __lines_list
@ -28,31 +28,31 @@ local -a __lines_list
# Check if chroma should end test if token is of type
# "starts new command", if so pass-through chroma ends
[[ "$__arg_type" = 3 ]] && return 2
[[ $__arg_type = 3 ]] && return 2
if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
return 1
fi
__wrd="${${${(Q)__wrd}#[\"\']}%[\"\']}"
if [[ "$__wrd" = -* && "$__wrd" != -*c* ]]; then
__wrd=${${${(Q)__wrd}#[\"\']}%[\"\']}
if [[ $__wrd = -* && $__wrd != -*c* ]]; then
__style=${FAST_THEME_NAME}${${${__wrd:#--*}:+single-hyphen-option}:-double-hyphen-option}
else
if (( FAST_HIGHLIGHT[chrome-git-got-c] == 1 )); then
for (( __idx1 = 1, __idx2 = 1; __idx2 <= __asize; ++ __idx1 )); do
[[ "${__arg[__idx2]}" = "${__wrd[__idx1]}" ]] && break
while [[ "${__arg[__idx2]}" != "${__wrd[__idx1]}" ]]; do
[[ ${__arg[__idx2]} = ${__wrd[__idx1]} ]] && break
while [[ ${__arg[__idx2]} != ${__wrd[__idx1]} ]]; do
(( ++ __idx2 ))
(( __idx2 > __asize )) && { __idx2=0; break; }
done
(( __idx2 == 0 )) && break
[[ "${__arg[__idx2]}" = "${__wrd[__idx1]}" ]] && break
[[ ${__arg[__idx2]} = ${__wrd[__idx1]} ]] && break
done
FAST_HIGHLIGHT[chrome-git-got-c]=0
(( _start_pos-__PBUFLEN >= 0 )) && \
-fast-highlight-process "$PREBUFFER" "${__wrd}" "$(( __start_pos + __idx2 - 1 ))"
elif [[ "$__wrd" = -*c* ]]; then
elif [[ $__wrd = -*c* ]]; then
FAST_HIGHLIGHT[chrome-git-got-c]=1
else
return 1
@ -61,7 +61,7 @@ local -a __lines_list
}
# Add region_highlight entry (via `reply' array)
[[ -n "$__style" ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
[[ -n $__style ]] && (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
# We aren't passing-through, do obligatory things ourselves
(( this_word = next_word ))