mirror of
git://git.code.sf.net/p/zsh/code
synced 2026-01-01 20:11:06 +01:00
14330: handle quotes better in _most_recent_file
This commit is contained in:
parent
015120a287
commit
ea03bf1ae5
2 changed files with 14 additions and 7 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2001-05-14 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 14330: Completion/Base/Widget/_most_recent_file: handle filenames
|
||||
which need quoted characters better.
|
||||
|
||||
2001-05-14 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 14327: Src/exec.c: set list_pipe_job only for real pipelines
|
||||
|
|
|
|||
|
|
@ -1,22 +1,24 @@
|
|||
#compdef -k complete-word \C-xm
|
||||
|
||||
# Complete the most recent file matching the pattern on the line so
|
||||
# far: globbing is active, i.e. *.txt will be expanded to the most recent
|
||||
# Complete the most recently modified file matching the pattern on the line
|
||||
# so far: globbing is active, i.e. *.txt will be expanded to the most recent
|
||||
# file ending in .txt
|
||||
#
|
||||
# With a prefix argument, select the Nth most recent matching file;
|
||||
# negative arguments work in the opposite direction, so for example
|
||||
# `Esc - \C-x m' gets you the oldest file.
|
||||
#
|
||||
# (`Most recent' means most recently modified.)
|
||||
|
||||
local file tilde etilde
|
||||
if [[ $PREFIX = \~*/* ]]; then
|
||||
tilde=${PREFIX%%/*}
|
||||
etilde=${~tilde}
|
||||
file=($~PREFIX*$~SUFFIX(om[${NUMERIC:-1}]N))
|
||||
file=(${file/#$etilde/$tilde})
|
||||
# PREFIX and SUFFIX have full command line quoting in, but we want
|
||||
# any globbing characters which are quoted to stay quoted.
|
||||
eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))"
|
||||
file=(${file/#$etilde})
|
||||
file=($tilde${(q)^file})
|
||||
else
|
||||
file=($~PREFIX*$~SUFFIX(om[${NUMERIC:-1}]N))
|
||||
eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))"
|
||||
file=(${(q)file})
|
||||
fi
|
||||
(( $#file )) && compadd -U -i "$IPREFIX" -I "$ISUFFIX" -f -Q $file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue