mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-22 03:13:09 +00:00
*highlight: Optimization: expand path once
This commit is contained in:
parent
d37fe9d4b6
commit
1c6493100b
1 changed files with 6 additions and 6 deletions
|
@ -255,6 +255,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
||||||
integer this_word=BIT_start next_word=0
|
integer this_word=BIT_start next_word=0
|
||||||
|
|
||||||
integer in_redirection
|
integer in_redirection
|
||||||
|
local expanded_path
|
||||||
# Processing buffer
|
# Processing buffer
|
||||||
local proc_buf="$buf"
|
local proc_buf="$buf"
|
||||||
for arg in ${interactive_comments-${(z)buf}} \
|
for arg in ${interactive_comments-${(z)buf}} \
|
||||||
|
@ -367,6 +368,8 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
expanded_path=""
|
||||||
|
|
||||||
# The Great Fork: is this a command word? Is this a non-command word?
|
# The Great Fork: is this a command word? Is this a non-command word?
|
||||||
if (( this_word & BIT_always )) && [[ $arg == 'always' ]]; then
|
if (( this_word & BIT_always )) && [[ $arg == 'always' ]]; then
|
||||||
# try-always construct
|
# try-always construct
|
||||||
|
@ -381,9 +384,8 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
||||||
(( next_word = next_word | BIT_sudo_opt ))
|
(( next_word = next_word | BIT_sudo_opt ))
|
||||||
(( next_word = next_word | BIT_start ))
|
(( next_word = next_word | BIT_start ))
|
||||||
else
|
else
|
||||||
unset REPLY
|
: ${expanded_path::=${(Q)~arg}}
|
||||||
: ${REPLY:=${(Q)~arg}}
|
-hsmw-highlight-main-type $expanded_path
|
||||||
-hsmw-highlight-main-type $REPLY
|
|
||||||
() {
|
() {
|
||||||
# Special-case: command word is '$foo', like that, without braces or anything.
|
# Special-case: command word is '$foo', like that, without braces or anything.
|
||||||
#
|
#
|
||||||
|
@ -639,9 +641,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
||||||
# Else, return non-zero (and the contents of $REPLY is undefined).
|
# Else, return non-zero (and the contents of $REPLY is undefined).
|
||||||
-hsmw-highlight-check-path()
|
-hsmw-highlight-check-path()
|
||||||
{
|
{
|
||||||
unset REPLY
|
: ${expanded_path:=${(Q)~arg}}
|
||||||
: ${REPLY:=${(Q)~arg}}
|
|
||||||
local expanded_path="$REPLY"
|
|
||||||
|
|
||||||
REPLY=path
|
REPLY=path
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue