From 1dcfc3c3729b0c920d033b7d05c6063a87d956ae Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Tue, 25 Oct 2016 16:58:55 +0200 Subject: [PATCH] *highlight: Don't redefine already_added, don't set it for comments parse.zsh -oo, after changes: Running time: 1.8225100000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1814,83 5,19 99,99% 1336,69 3,82 73,65% -hsmw-highlight-process 2) 2800 338,83 0,12 18,67% 338,83 0,12 18,67% -hsmw-highlight-string 3) 2450 81,75 0,03 4,50% 81,75 0,03 4,50% -hsmw-highlight-check-path 4) 1400 39,80 0,03 2,19% 39,80 0,03 2,19% -hsmw-highlight-main-type 5) 350 9,74 0,03 0,54% 9,74 0,03 0,54% -hsmw-highlight-stack-pop 6) 350 8,02 0,02 0,44% 8,02 0,02 0,44% -hsmw-highlight-path-separators 7) 1 0,10 0,10 0,01% 0,10 0,10 0,01% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init --- hsmw-highlight | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hsmw-highlight b/hsmw-highlight index daa92c7..d3a2663 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -280,7 +280,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( # integer BIT_start=1 BIT_regular=2 BIT_sudo_opt=4 BIT_sudo_arg=8 BIT_always=16 - integer this_word=BIT_start next_word=0 + integer this_word=BIT_start next_word=0 already_added # Processing buffer local proc_buf="$buf" @@ -301,7 +301,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( # for this iteration. Currently, that is done for "" and $'' strings, # which add the entry early so escape sequences within the string override # the string's color. - integer already_added=0 + already_added=0 style=unknown-token if (( this_word & BIT_start )); then in_array_assignment=0 @@ -350,7 +350,6 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( fi # ADD reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}") - already_added=1 continue fi