about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-01-16 10:54:07 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-01-16 10:54:07 +0000
commit110ae85114abc12211e2fcae7dafc6400e57cdb1 (patch)
tree5d825bee5db476d72e86e889ed37fd5f23b71702
parent7f6ea229a81ee728befe64d8a97c397fdc3dffb8 (diff)
downloadzsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.tar.gz
zsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.tar.xz
zsh-110ae85114abc12211e2fcae7dafc6400e57cdb1.zip
users/11113: improve _todo.sh
-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
-