mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-24 20:33:04 +00:00
*highlight: Optimization and slowdown – short path for actual new lines
parse.zsh ./to-parse.zsh changes.out, before changes: Running time: 2.2866420000 num calls time self name ----------------------------------------------------------------------------------- 1) 1 2286,16 2286,16 100,00% 2131,92 2131,92 93,25% -hsmw-highlight-process 2) 1270 133,34 0,10 5,83% 133,34 0,10 5,83% -hsmw-highlight-main-type 3) 395 12,09 0,03 0,53% 12,09 0,03 0,53% -hsmw-highlight-check-path 4) 22 5,48 0,25 0,24% 5,48 0,25 0,24% -hsmw-highlight-string 5) 6 2,36 0,39 0,10% 2,36 0,39 0,10% -hsmw-highlight-dollar-string 6) 46 0,97 0,02 0,04% 0,97 0,02 0,04% -hsmw-highlight-stack-pop 7) 1 0,07 0,07 0,00% 0,07 0,07 0,00% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init parse.zsh ./to-parse.zsh changes.out, after changes: Running time: 2.1237140000 num calls time self name ----------------------------------------------------------------------------------- 1) 1 2123,18 2123,18 100,00% 1979,84 1979,84 93,25% -hsmw-highlight-process 2) 755 122,09 0,16 5,75% 122,09 0,16 5,75% -hsmw-highlight-main-type 3) 395 13,66 0,03 0,64% 13,66 0,03 0,64% -hsmw-highlight-check-path 4) 22 4,46 0,20 0,21% 4,46 0,20 0,21% -hsmw-highlight-string 5) 6 2,04 0,34 0,10% 2,04 0,34 0,10% -hsmw-highlight-dollar-string 6) 46 1,10 0,02 0,05% 1,10 0,02 0,05% -hsmw-highlight-stack-pop 7) 1 0,07 0,07 0,00% 0,07 0,07 0,00% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init ./parse.zsh -oo, after changes: Running time: 1.5936520000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1586,12 4,53 99,99% 1222,20 3,49 77,05% -hsmw-highlight-process 2) 2800 288,42 0,10 18,18% 288,42 0,10 18,18% -hsmw-highlight-string 3) 1750 40,57 0,02 2,56% 40,57 0,02 2,56% -hsmw-highlight-check-path 4) 1400 24,97 0,02 1,57% 24,97 0,02 1,57% -hsmw-highlight-main-type 5) 350 9,96 0,03 0,63% 9,96 0,03 0,63% -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
8e8969095b
commit
bf306203f9
1 changed files with 11 additions and 0 deletions
|
@ -309,6 +309,17 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
|
|||
(( start_pos += offset ))
|
||||
(( end_pos = start_pos + $#arg ))
|
||||
|
||||
# Do not run default code for case when there is a new line
|
||||
# It shouldn't be treated as ';', i.e. shouldn't be highlighted
|
||||
# as unknown-token when appears after command-starting arg like "{"
|
||||
if [[ "${proc_buf[offset+1]}" = $'\n' ]]; then
|
||||
(( in_array_assignment )) && (( this_word = 2 )) || { (( this_word = 1 )); highlight_glob=1; }
|
||||
in_redirection=0
|
||||
proc_buf="${proc_buf[offset + $#arg + 1,len]}"
|
||||
start_pos=$end_pos
|
||||
continue
|
||||
fi
|
||||
|
||||
arg_type=3
|
||||
else
|
||||
offset=0
|
||||
|
|
Loading…
Reference in a new issue