Merge pull request #1289 from zsh-users/do-not-overwrite-match-arrays

Declare match, mbegin, mend arrays when using regexp
This commit is contained in:
Shohei YOSHIDA 2026-08-14 09:14:20 +09:00 committed by GitHub
commit 2798b16c74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 2 deletions

View File

@ -84,7 +84,8 @@ _arguments \
_chromium_proxyurls () { _chromium_proxyurls () {
#TODO: semicolon separated urls not yet implemented #TODO: semicolon separated urls not yet implemented
# mostly copied from _urls # mostly copied from _urls
local ipre scheme host user uhosts ret=1 expl match glob suf local ipre scheme host user uhosts ret=1 expl glob suf
local -a match mbegin mend
local localhttp local localhttp
zstyle -a ":completion:${curcontext}:urls" local localhttp zstyle -a ":completion:${curcontext}:urls" local localhttp
local localhttp_servername="$localhttp[1]" local localhttp_servername="$localhttp[1]"

View File

@ -166,6 +166,7 @@ _cmake_build_presets() {
(( $+functions[_cmake_json_field] )) || (( $+functions[_cmake_json_field] )) ||
_cmake_json_field() { _cmake_json_field() {
local json="$1" key="$2" local json="$1" key="$2"
local -a match mbegin mend
# Non-greedy match of: "key" <ws> : <ws> " value " # Non-greedy match of: "key" <ws> : <ws> " value "
if [[ $json =~ "\"$key\"[[:space:]]*:[[:space:]]*\"([^\"]*)\"" ]]; then if [[ $json =~ "\"$key\"[[:space:]]*:[[:space:]]*\"([^\"]*)\"" ]]; then
print -r -- "$match[1]" print -r -- "$match[1]"
@ -213,6 +214,7 @@ _cmake_json_inherited_field() {
fi fi
local parent local parent
local -a match mbegin mend
if [[ $block =~ '"inherits"[[:space:]]*:[[:space:]]*\[([^]]*)\]' ]]; then if [[ $block =~ '"inherits"[[:space:]]*:[[:space:]]*\[([^]]*)\]' ]]; then
for parent in ${(s:,:)match[1]}; do for parent in ${(s:,:)match[1]}; do
parent=${parent//[\"[:space:]]/} parent=${parent//[\"[:space:]]/}

View File

@ -346,6 +346,7 @@ __git_flow_feature_list() {
__git_flow_remote() { __git_flow_remote() {
local expl gitdir remotes local expl gitdir remotes
local -a match mbegin mend
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_flow_command_successful || return __git_flow_command_successful || return

View File

@ -234,7 +234,7 @@ while (( $#state )); do
;; ;;
query) query)
local -a accs keywords local -a accs keywords match mbegin mend
keywords=( keywords=(
'acct\::match account names' 'acct\::match account names'
'code\::match by transaction code' 'code\::match by transaction code'

View File

@ -43,6 +43,7 @@
_httpie_params() { _httpie_params() {
local ret=1 expl local ret=1 expl
local -a match mbegin mend
# or a url # or a url
if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
@ -123,6 +124,7 @@ _httpie_urls() {
_httpie_printflags() { _httpie_printflags() {
local ret=1 local ret=1
local -a match mbegin mend
# not sure why this is necessary, but it will complete "-pH" style without it # not sure why this is necessary, but it will complete "-pH" style without it
[[ $IPREFIX == "-p" ]] && IPREFIX+=" " [[ $IPREFIX == "-p" ]] && IPREFIX+=" "