1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-14 11:41:07 +02:00

unposted: further update to _todo.sh

also I forgot to commit the previous one
This commit is contained in:
Peter Stephenson 2010-08-10 17:13:42 +00:00
parent a9e7fd4e75
commit d2e3b6eb62
2 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2010-08-10 Peter Stephenson <pws@csr.com>
* unposted: Completion/Unix/Command/_todo.sh: need care matching
initial whitespace; strip priorities to get text to replace.
2010-08-08 Peter Stephenson <p.w.stephenson@ntlworld.com> 2010-08-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 28137: Functions/MIME/zsh-mime-handler: $argv[0] should be * 28137: Functions/MIME/zsh-mime-handler: $argv[0] should be
@ -13503,5 +13508,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5052 $ * $Revision: 1.5053 $
***************************************************** *****************************************************

View file

@ -6,9 +6,9 @@
# - "replace" will complete the original text for editing # - "replace" will complete the original text for editing
# - completing priorities will cycle through A to Z (even without # - completing priorities will cycle through A to Z (even without
# menu completion) # menu completion)
# - list and listall will complete p:<project> and @<where> from # - list and listall will complete +<project> and @<where> from
# values in existing entries # values in existing entries
# - will complete after p: and @ if typed in message text # - will complete after + and @ if typed in message text
setopt localoptions braceccl setopt localoptions braceccl
@ -53,7 +53,7 @@ case $state in
case $words[NORMARG] in case $words[NORMARG] in
(append|del|do|prepend|pri|replace) (append|del|do|prepend|pri|replace)
if (( NORMARG == CURRENT - 1 )); then if (( NORMARG == CURRENT - 1 )); then
itemlist=(${${(M)${(f)"$(todo.sh -p list)"}##<-> *}/(#b)(<->) (*)/${match[1]}:${match[2]}}) itemlist=(${${(M)${(f)"$(todo.sh -p list | sed '/^--/,$d')"}##<-> *}/(#b)(<->) (*)/${match[1]}:${match[2]}})
_describe -t todo-items 'todo item' itemlist _describe -t todo-items 'todo item' itemlist
else else
case $words[NORMARG] in case $words[NORMARG] in
@ -64,7 +64,7 @@ case $state in
nextstate=proj nextstate=proj
;; ;;
(replace) (replace)
compadd -Q -- "${(qq)$(todo.sh -p list "^0*${words[CURRENT-1]} ")##<-> }" compadd -Q -- "${(qq)$(todo.sh -p list "^[ 0]*${words[CURRENT-1]} " | sed '/^--/,$d')##<-> (\([A-Z]\) |)}"
;; ;;
esac esac
fi fi
@ -102,15 +102,15 @@ case $nextstate in
;; ;;
(proj) (proj)
# This completes stuff beginning with p: (projects) or @ (contexts); # This completes stuff beginning with + (projects) or @ (contexts);
# these are todo.sh conventions. # these are todo.sh conventions.
if [[ ! -prefix p: && ! -prefix @ ]]; then if [[ ! -prefix + && ! -prefix @ ]]; then
projmsg=$txtmsg projmsg=$txtmsg
fi fi
# In case there are quotes, ignore anything up to whitespace before # In case there are quotes, ignore anything up to whitespace before
# the p: or @ (which may not even be there yet). # the + or @ (which may not even be there yet).
compset -P '*[[:space:]]' compset -P '*[[:space:]]'
_wanted search expl $projmsg \ _wanted search expl $projmsg \
compadd ${${=${${(M)${(f)"$(todo.sh -p list)"}##<-> *}##<-> }}:#^(p:*|@*)} compadd $(todo.sh lsprj) $(todo.sh lsc)
;; ;;
esac esac