mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-25 12:50:25 +00:00
*highlight: Replace almost all regular expressions with patterns
This commit is contained in:
parent
d6e300f757
commit
eee000e0c5
1 changed files with 3 additions and 3 deletions
|
@ -425,7 +425,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
|||
local -a match mbegin mend
|
||||
local MATCH; integer MBEGIN MEND
|
||||
if [[ $res == none ]] && (( ${+parameters} )) &&
|
||||
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
|
||||
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} = ([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##) ]] &&
|
||||
(( ${+parameters[${MATCH}]} ))
|
||||
then
|
||||
-hsmw-highlight-main-type ${(P)MATCH}
|
||||
|
@ -715,10 +715,10 @@ typeset -gA HSMW_HIGHLIGHT_STYLES
|
|||
case "$arg[$i]" in
|
||||
'$' ) style=dollar-double-quoted-argument
|
||||
# Look for an alphanumeric parameter name.
|
||||
if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then
|
||||
if [[ ${arg:$i} = ([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##) ]] ; then
|
||||
(( k += $#MATCH )) # highlight the parameter name
|
||||
(( i += $#MATCH )) # skip past it
|
||||
elif [[ ${arg:$i} =~ ^[{]([A-Za-z_][A-Za-z0-9_]*|[0-9]+)[}] ]] ; then
|
||||
elif [[ ${arg:$i} = [{]([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##)[}]* ]] ; then
|
||||
(( k += $#MATCH )) # highlight the parameter name and braces
|
||||
(( i += $#MATCH )) # skip past it
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue