about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_ps123429
2 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index bf8aeb54c..8d9bc789d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-06  Mikael Magnusson  <mikachu@gmail.com>
+
+	* 35696: Completion/Unix/Type/_ps1234: complete colors for %F{
+	and %K{
+
 2015-07-06  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 35441: Etc/zsh-development-guide: Make devs' ChangeLog
diff --git a/Completion/Unix/Type/_ps1234 b/Completion/Unix/Type/_ps1234
index 13c90b50c..866349fa9 100644
--- a/Completion/Unix/Type/_ps1234
+++ b/Completion/Unix/Type/_ps1234
@@ -1,12 +1,10 @@
 #compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default-
 
 local -a specs
-local expl paren
+local expl bs
 
-if [[ -n $compstate[quote] ]]; then
-  paren='('
-else
-  paren='\('
+if [[ -z $compstate[quote] ]]; then
+  bs='\'
 fi
 
 if [[ $PREFIX == *%(-|)<-># ]]; then
@@ -76,7 +74,7 @@ if [[ $PREFIX == *%(-|)<-># ]]; then
   compset -P "*"
   _describe -t prompt-format-specifier 'prompt format specifier' specs -S ''
   _message -e prompt-format-specifier number
-elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
+elif [[ $PREFIX == *%$bs\((-|)<-># ]]; then
   specs=(
     '!:running with privileges'
     '#:effective uid'
@@ -103,6 +101,25 @@ elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
   compset -P "*"
   _describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S ''
   _message -e ternary-prompt-expression number
+elif [[ $PREFIX == *%[FK]$bs\{[0-9a-z]# ]]; then
+  specs=(
+    black
+    red
+    green
+    yellow
+    blue
+    magenta
+    cyan
+    white
+    default
+  )
+  compset -P "*{"
+  _describe -t ansi-color-name 'ansi color' specs -S $bs\}
+  if compset -P "<->"; then
+    _wanted ansi-color-number expl 'close brace' compadd -S '' \}
+  else
+    _message -e ansi-color-number "number between 0 and $(( $terminfo[colors] - 1 ))"
+  fi
 else
   _describe -t prompt-format-specifier 'prompt format specifier' '(%)' -S ''
   _default "$@"