1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-17 21:18:06 +02:00

Protect some :s from history modifier expansion

This commit is contained in:
Stephane Chazelas 2023-06-02 16:09:53 +01:00 committed by Peter Stephenson
parent 78102120b9
commit 0577dafcaa
7 changed files with 24 additions and 8 deletions
ChangeLog
Completion

View file

@ -1,5 +1,8 @@
2023-06-06 Peter Stephenson <p.stephenson@samsung.com>
* Stephane: 51817: Protect some use of ':' from history modifier
interpreation.
* 51816: Doc/Zsh/expn.yo, Src/hist.c, Src/subst.c,
Test/D04parameter.ztst: add :S history modifier with pattern
match.

View file

@ -79,8 +79,8 @@ case $state in
compset -P '*:'
compset -S ':*'
_alternative \
"classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \
"classpath:$state:_path_files -r': ' -/" && ret=0
"classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \
"classpath:${state}:_path_files -r': ' -/" && ret=0
;;
property)
if compset -P 1 '*='; then

View file

@ -0,0 +1,13 @@
--- Completion/Unix/Command/_ant
+++ Completion/Unix/Command/_ant
@@ -79,8 +79,8 @@ case $state in
compset -P '*:'
compset -S ':*'
_alternative \
- "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \
- "classpath:$state:_path_files -r': ' -/" && ret=0
+ "classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \
+ "classpath:${state}:_path_files -r': ' -/" && ret=0
;;
property)
if compset -P 1 '*='; then

View file

@ -125,7 +125,7 @@ local -a _ffmpeg_argspecs
lastopt_description=${lastopt_description//:/\\:}
if [[ $example == filename ]]; then
lastopt_takesargs=0
lastopt+=":$lastopt_description:_files"
lastopt+=":${lastopt_description}:_files"
elif [[ $lastopt == -[asv]pre ]]; then
lastopt_takesargs=0
lastopt="*$lastopt"

View file

@ -438,8 +438,8 @@ classpath|sourcepath|bootstrapclasspath|docletpath)
compset -P '*:'
compset -S ':*'
_alternative \
"classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \
"classpath:$state:_path_files -r': ' -/" && return
"classpath:${state}:_path_files -qS: -g '*.(jar|zip)(-.)'" \
"classpath:${state}:_path_files -r': ' -/" && return
;;
extdirs)

View file

@ -139,7 +139,7 @@ _svn () {
;;
(commit)
args=(
${args/(#b)(*--file*):arg:/$match[1]:file:_files}
${args/(#b)(*--file*):arg:/${match[1]}:file:_files}
'*:file: _svn_modified "committable"'
)
;;
@ -189,7 +189,7 @@ _svn () {
args=(
':propname:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock svn:global-ignores svn:auto-props)'
':propval:->propset_propval'
${args/(#b)(*--file*):arg:/$match[1]:file:_files}
${args/(#b)(*--file*):arg:/${match[1]}:file:_files}
'*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"'
)
;;

View file

@ -73,7 +73,7 @@ else
if zstyle -t ":completion:${curcontext}:path-directories" separate-sections; then
local elem
for ((elem=1; elem <= $#tmpcdpath; elem++)); do
alt+=( "path-directories-$elem:directory in $tmpcdpath[$elem]:_path_files -W 'tmpcdpath[$elem]' -/" )
alt+=( "path-directories-${elem}:directory in ${tmpcdpath[$elem]}:_path_files -W 'tmpcdpath[$elem]' -/" )
done
else
(( $#tmpcdpath )) &&