mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-24 20:33:04 +00:00
*highlight: Optimization: There are no path_prefix_* styles anymore
parse.zsh -oo, after changes: Running time: 1.6545150000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1647,16 4,71 99,99% 1211,88 3,46 73,57% -hsmw-highlight-process 2) 2800 324,01 0,12 19,67% 324,01 0,12 19,67% -hsmw-highlight-string 3) 2450 71,72 0,03 4,35% 71,72 0,03 4,35% -hsmw-highlight-check-path 4) 1400 24,49 0,02 1,49% 24,49 0,02 1,49% -hsmw-highlight-main-type 5) 350 9,73 0,03 0,59% 9,73 0,03 0,59% -hsmw-highlight-stack-pop 6) 350 5,32 0,02 0,32% 5,32 0,02 0,32% -hsmw-highlight-path-separators 7) 1 0,08 0,08 0,01% 0,08 0,08 0,01% -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
2ede95f080
commit
ae8990c53b
1 changed files with 3 additions and 6 deletions
|
@ -45,8 +45,6 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
|||
: ${HSMW_HIGHLIGHT_STYLES[hashed-command]:=fg=green}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[path]:=fg=magenta}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[path_pathseparator]:=}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[path_prefix]:=fg=magenta}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[path_prefix_pathseparator]:=}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[globbing]:=fg=blue,bold}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[history-expansion]:=fg=blue,bold}
|
||||
: ${HSMW_HIGHLIGHT_STYLES[single-hyphen-option]:=none}
|
||||
|
@ -561,7 +559,7 @@ __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" || $style == "path_prefix" ]] && -hsmw-highlight-path-separators
|
||||
[[ $style == "path" ]] && -hsmw-highlight-path-separators
|
||||
fi
|
||||
if (( arg_type == 3 )); then
|
||||
if [[ $arg == ';' ]] && (( in_array_assignment )); then
|
||||
|
@ -593,9 +591,8 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
|
||||
-hsmw-highlight-path-separators()
|
||||
{
|
||||
local pos style_pathsep
|
||||
style_pathsep=${style}_pathseparator
|
||||
[[ -z "$HSMW_HIGHLIGHT_STYLES[$style_pathsep]" || "$HSMW_HIGHLIGHT_STYLES[$style]" == "$HSMW_HIGHLIGHT_STYLES[$style_pathsep]" ]] && return 0
|
||||
local pos
|
||||
[[ -z "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" || "$HSMW_HIGHLIGHT_STYLES[path]" == "$HSMW_HIGHLIGHT_STYLES[path_pathseparator]" ]] && return 0
|
||||
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
|
||||
# ADD
|
||||
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[$style_pathsep]}")
|
||||
|
|
Loading…
Reference in a new issue