about summary refs log tree commit diff
path: root/Completion/Unix/Command/_todo.sh
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-10-19 08:40:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-10-19 08:40:58 +0000
commit7d75ea056b9a70bab13c36cdca1e04abef7da808 (patch)
tree96ca41f519de09419ecc64b860df3ceb4366dfb4 /Completion/Unix/Command/_todo.sh
parentd3fe55f08b04ba66278bd16ce261c6df0eebfaa2 (diff)
downloadzsh-7d75ea056b9a70bab13c36cdca1e04abef7da808.tar.gz
zsh-7d75ea056b9a70bab13c36cdca1e04abef7da808.tar.xz
zsh-7d75ea056b9a70bab13c36cdca1e04abef7da808.zip
22885: fix problems with multibyte tokenized strings
unposted: _todo.sh: more contexts
Diffstat (limited to 'Completion/Unix/Command/_todo.sh')
-rw-r--r--Completion/Unix/Command/_todo.sh32
1 files changed, 24 insertions, 8 deletions
diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh
index fc984f7d4..2b6b444ee 100644
--- a/Completion/Unix/Command/_todo.sh
+++ b/Completion/Unix/Command/_todo.sh
@@ -3,9 +3,12 @@
 # See http://todotxt.com for todo.sh.
 #
 # Featurettes:
-#  - "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
-#    menu completion).
+#    menu completion)
+#  - list and listall will complete p:<project> and @<where> from
+#    values in existing entries
+#  - will complete after p: and @ if typed in message text
 
 setopt localoptions braceccl
 
@@ -57,7 +60,11 @@ case $state in
 	nextstate=pri
 	;;
 	(append|prepend)
-	_message $txtmsg
+	if [[ -prefix p: || -prefix @ ]]; then
+	  nextstate=proj
+	else
+	  _message $txtmsg
+	fi
 	;;
 	(replace)
 	compadd -Q -- "${(qq)$(todo.sh list "^0*${words[CURRENT-1]} ")##<-> }"
@@ -67,14 +74,15 @@ case $state in
     ;;
 
     (add)
-    _message $txtmsg
+    if [[ -prefix p: || -prefix @ ]]; then
+      nextstate=proj
+    else
+      _message $txtmsg
+    fi
     ;;
 
     (list|listall)
-    # This completes stuff beginning with p: (projects) or @ (contexts);
-    # these are todo.sh conventions.
-    _wanted search expl 'context or project' \
-      compadd ${${=${${(M)${(f)"$(todo.sh list)"}##<-> *}##<-> }}:#^(p:*|@*)}
+    nextstate=proj
     ;;
 
     (listpri)
@@ -103,4 +111,12 @@ case $nextstate in
     _wanted priority expl 'priority' compadd {A-Z}
   fi
   ;;
+
+  (proj)
+  # This completes stuff beginning with p: (projects) or @ (contexts);
+  # these are todo.sh conventions.
+  _wanted search expl 'context or project' \
+    compadd ${${=${${(M)${(f)"$(todo.sh list)"}##<-> *}##<-> }}:#^(p:*|@*)}
+  ;;
 esac
+