about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_todo.sh30
2 files changed, 18 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index cbb3a3d00..937c026fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-16  Peter Stephenson  <pws@csr.com>
+
+	* users/11113: Completion/Unix/Command/_todo.sh: extend
+	project and context completion to ordinary text and complete
+	after whitespace in quotes.
+
 2007-01-15  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 23107, 23109: Config/defs.mk.in: suppress parallel makes.
diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh
index 455bb3d85..3bae98b1a 100644
--- a/Completion/Unix/Command/_todo.sh
+++ b/Completion/Unix/Command/_todo.sh
@@ -13,7 +13,7 @@
 setopt localoptions braceccl
 
 local expl curcontext="$curcontext" state line pri nextstate
-local -a cmdlist itemlist
+local -a cmdlist itemlist match mbegin mend
 integer NORMARG
 
 _arguments -s -n : \
@@ -26,7 +26,8 @@ _arguments -s -n : \
   '1:command:->commands' \
   '*:arguments:->arguments' && return 0
 
-local txtmsg="text, can include p:<project> and @<where>"
+local projmsg="context or project"
+local txtmsg="text with contexts or projects"
 
 case $state in
   (commands)
@@ -60,11 +61,7 @@ case $state in
 	nextstate=pri
 	;;
 	(append|prepend)
-	if [[ -prefix p: || -prefix @ ]]; then
-	  nextstate=proj
-	else
-	  _message $txtmsg
-	fi
+	nextstate=proj
 	;;
 	(replace)
 	compadd -Q -- "${(qq)$(todo.sh -p list "^0*${words[CURRENT-1]} ")##<-> }"
@@ -73,15 +70,7 @@ case $state in
     fi
     ;;
 
-    (add)
-    if [[ -prefix p: || -prefix @ ]]; then
-      nextstate=proj
-    else
-      _message $txtmsg
-    fi
-    ;;
-
-    (list|listall)
+    (add|list|listall)
     nextstate=proj
     ;;
 
@@ -115,8 +104,13 @@ case $nextstate in
   (proj)
   # This completes stuff beginning with p: (projects) or @ (contexts);
   # these are todo.sh conventions.
-  _wanted search expl 'context or project' \
+  if [[ ! -prefix p: && ! -prefix @ ]]; then
+    projmsg=$txtmsg
+  fi
+  # In case there are quotes, ignore anything up to whitespace before
+  # the p: or @ (which may not even be there yet).
+  compset -P '*[[:space:]]'
+  _wanted search expl $projmsg \
     compadd ${${=${${(M)${(f)"$(todo.sh -p list)"}##<-> *}##<-> }}:#^(p:*|@*)}
   ;;
 esac
-