mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2025-02-16 11:08:23 +00:00
*highlight: Small *-string optimization, use mend and mbegin
A few miliseconds gain.
This commit is contained in:
parent
08419957ee
commit
7bbc05b0b0
1 changed files with 7 additions and 7 deletions
|
@ -695,14 +695,14 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
|||
local mybuf="$arg"
|
||||
integer idx=start_pos end_idx
|
||||
|
||||
while [[ "$mybuf" = (#b)([^\$\\]#)((\$[[:alnum:]_]##(\[[^[:space:]]#\])(#c0,1))|(\$[{](\([a-zA-Z0@%#]##\))(#c0,1)[[:alnum:]_]##(\[[^[:space:]]#\])(#c0,1)[}])|[\\][\'\"\$]|[\\](*))(*) ]]; do
|
||||
[[ -n "${match[8]}" ]] && {
|
||||
idx+="${#match[1]}"+1
|
||||
mybuf="${match[8]}"
|
||||
while [[ "$mybuf" = (#b)[^\$\\]#((\$[[:alnum:]_]##(\[[^[:space:]]#\])(#c0,1))|(\$[{](\([a-zA-Z0@%#]##\))(#c0,1)[[:alnum:]_]##(\[[^[:space:]]#\])(#c0,1)[}])|[\\][\'\"\$]|[\\](*))(*) ]]; do
|
||||
[[ -n "${match[7]}" ]] && {
|
||||
idx+=${mbegin[1]}
|
||||
mybuf="${match[7]}"
|
||||
} || {
|
||||
idx+="${#match[1]}"
|
||||
end_idx=idx+"${#match[2]}"
|
||||
mybuf="${match[9]}"
|
||||
idx+=${mbegin[1]}-1
|
||||
end_idx=idx+${mend[1]}-${mbegin[1]}+1
|
||||
mybuf="${match[8]}"
|
||||
|
||||
# ADD
|
||||
reply+=("$idx $end_idx ${HSMW_HIGHLIGHT_STYLES[dollar-double-quoted-argument]}")
|
||||
|
|
Loading…
Add table
Reference in a new issue