mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-24 20:33:04 +00:00
*highlight: Simpler region_highlight gathering function
parse.zsh, before change: Running time: 1.0912980000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1084,72 3,10 100,00% 658,39 1,88 60,70% -hsmw-highlight-process 2) 3100 152,66 0,05 14,07% 152,66 0,05 14,07% -hsmw-add-highlight 3) 300 68,71 0,23 6,33% 68,71 0,23 6,33% -hsmw-highlight-string 4) 950 83,72 0,09 7,72% 62,34 0,07 5,75% -hsmw-highlight-check-path 5) 1950 43,76 0,02 4,03% 43,76 0,02 4,03% -hsmw-highlight-expand-path 6) 1000 36,57 0,04 3,37% 36,57 0,04 3,37% -hsmw-highlight-main-type 7) 1000 35,66 0,04 3,29% 35,66 0,04 3,29% (anon) 8) 3100 19,93 0,01 1,84% 19,93 0,01 1,84% -hsmw-highlight-is-redirection parse.zsh, after change: Running time: 0.9645980000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 958,25 2,74 100,00% 635,22 1,81 66,29% -hsmw-highlight-process 2) 300 67,91 0,23 7,09% 67,91 0,23 7,09% -hsmw-highlight-string 3) 3100 60,76 0,02 6,34% 60,76 0,02 6,34% -hsmw-add-highlight 4) 950 78,50 0,08 8,19% 57,73 0,06 6,02% -hsmw-highlight-check-path 5) 1950 42,46 0,02 4,43% 42,46 0,02 4,43% -hsmw-highlight-expand-path 6) 1000 34,58 0,03 3,61% 34,58 0,03 3,61% (anon) 7) 1000 34,06 0,03 3,55% 34,06 0,03 3,55% -hsmw-highlight-main-type 8) 3100 19,01 0,01 1,98% 19,01 0,01 1,98% -hsmw-highlight-is-redirection
This commit is contained in:
parent
3e296a3db9
commit
de167176a5
1 changed files with 5 additions and 11 deletions
|
@ -776,19 +776,13 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
|||
__hsmw_highlight_main__command_type_cache=()
|
||||
}
|
||||
|
||||
#
|
||||
# $1 - start position
|
||||
# $2 - end position
|
||||
# $3 - style name
|
||||
-hsmw-add-highlight()
|
||||
{
|
||||
local -i start end
|
||||
local highlight
|
||||
start=$1
|
||||
end=$2
|
||||
shift 2
|
||||
for highlight; do
|
||||
if (( $+HSMW_HIGHLIGHT_STYLES[$highlight] )); then
|
||||
reply+=("$start $end $HSMW_HIGHLIGHT_STYLES[$highlight]")
|
||||
break
|
||||
fi
|
||||
done
|
||||
(( ${+HSMW_HIGHLIGHT_STYLES[$3]} )) && reply+=("$1 $2 ${HSMW_HIGHLIGHT_STYLES[$3]}")
|
||||
}
|
||||
|
||||
__HSMW_MH_SOURCED=1
|
||||
|
|
Loading…
Reference in a new issue