mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-21 19:03:11 +00:00
*highlight: Optimization: Don't assign style
just to use its value
parse.zsh -oo, after changes: Running time: 1.6640020000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1656,49 4,73 99,99% 1215,36 3,47 73,37% -hsmw-highlight-process 2) 2800 326,28 0,12 19,70% 326,28 0,12 19,70% -hsmw-highlight-string 3) 2450 72,58 0,03 4,38% 72,58 0,03 4,38% -hsmw-highlight-check-path 4) 1400 24,87 0,02 1,50% 24,87 0,02 1,50% -hsmw-highlight-main-type 5) 350 9,75 0,03 0,59% 9,75 0,03 0,59% -hsmw-highlight-stack-pop 6) 350 7,66 0,02 0,46% 7,66 0,02 0,46% -hsmw-highlight-path-separators 7) 1 0,08 0,08 0,00% 0,08 0,08 0,00% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init
This commit is contained in:
parent
24aa777af6
commit
ced97ae261
1 changed files with 6 additions and 6 deletions
|
@ -469,9 +469,9 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
#
|
||||
# We highlight just the opening parentheses, as a reserved word; this
|
||||
# is how [[ ... ]] is highlighted, too.
|
||||
style=reserved-word
|
||||
|
||||
# ADD
|
||||
reply+=("$start_pos $(( start_pos + 2 )) ${HSMW_HIGHLIGHT_STYLES[$style]}")
|
||||
reply+=("$start_pos $(( start_pos + 2 )) ${HSMW_HIGHLIGHT_STYLES[reserved-word]}")
|
||||
already_added=1
|
||||
if [[ $arg[-2,-1] == '))' ]]; then
|
||||
# ADD
|
||||
|
@ -527,15 +527,15 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
'--'*) style=double-hyphen-option;;
|
||||
'-'*) style=single-hyphen-option;;
|
||||
"'"*) style=single-quoted-argument;;
|
||||
'"'*) style=double-quoted-argument
|
||||
'"'*)
|
||||
# ADD
|
||||
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
|
||||
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[double-quoted-argument]}")
|
||||
-hsmw-highlight-string
|
||||
already_added=1
|
||||
;;
|
||||
\$\'*) style=dollar-quoted-argument
|
||||
\$\'*)
|
||||
# ADD
|
||||
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
|
||||
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[dollar-quoted-argument]}")
|
||||
-hsmw-highlight-dollar-string
|
||||
already_added=1
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue