mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-21 19:03:11 +00:00
*highlight: Optimization: add path highlight in place; fix a style
10 runs before: 16700, 10 runs after: 16679. After run was rather unlucky. parse.zsh -oo, after changes: Running time: 1.6341780000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1626,82 4,65 99,99% 1193,40 3,41 73,35% -hsmw-highlight-process 2) 2800 325,47 0,12 20,01% 325,47 0,12 20,01% -hsmw-highlight-string 3) 2450 71,76 0,03 4,41% 71,76 0,03 4,41% -hsmw-highlight-check-path 4) 1400 26,52 0,02 1,63% 26,52 0,02 1,63% -hsmw-highlight-main-type 5) 350 9,68 0,03 0,59% 9,68 0,03 0,59% -hsmw-highlight-stack-pop 6) 1 0,07 0,07 0,00% 0,07 0,07 0,00% -hsmw-highlight-fill-option-variables 7) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init
This commit is contained in:
parent
5367ca4e1b
commit
2fac0a8a53
1 changed files with 11 additions and 8 deletions
|
@ -548,7 +548,17 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
style=redirection
|
||||
else
|
||||
if -hsmw-highlight-check-path; then
|
||||
style=path
|
||||
# ADD
|
||||
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[path]}")
|
||||
already_added=1
|
||||
|
||||
[[ -n "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" && "$HSMW_HIGHLIGHT_STYLES[path]" != "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" ]] && {
|
||||
local pos
|
||||
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
|
||||
# ADD
|
||||
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[path_pathseparator]}")
|
||||
done
|
||||
}
|
||||
else
|
||||
style=default
|
||||
fi
|
||||
|
@ -559,13 +569,6 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
if (( already_added == 0 )); then
|
||||
# ADD
|
||||
[[ "${HSMW_HIGHLIGHT_STYLES[$style]}" != "none" ]] && reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
|
||||
[[ $style == "path" && -n "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" && "$HSMW_HIGHLIGHT_STYLES[path]" != "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" ]] && {
|
||||
local pos
|
||||
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
|
||||
# ADD
|
||||
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[$style_pathsep]}")
|
||||
done
|
||||
}
|
||||
fi
|
||||
if (( arg_type == 3 )); then
|
||||
if [[ $arg == ';' ]] && (( in_array_assignment )); then
|
||||
|
|
Loading…
Reference in a new issue