about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-06-24 08:44:14 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-06-24 08:44:14 +0000
commita440669201fcaaefe7a83d901e18dbdd57cf9d0a (patch)
tree18126b5c9b302e6548b73dfbb600ade0a4ad3565
parent0d7df628a47f4d944a266fe547d1db3c6b55b6f1 (diff)
downloadzsh-a440669201fcaaefe7a83d901e18dbdd57cf9d0a.tar.gz
zsh-a440669201fcaaefe7a83d901e18dbdd57cf9d0a.tar.xz
zsh-a440669201fcaaefe7a83d901e18dbdd57cf9d0a.zip
25242: Mikael V prompt test for contents of psvar
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/prompt.yo2
-rw-r--r--Src/prompt.c6
3 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 77551ef16..295ceb67d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-24  Peter Stephenson  <pws@csr.com>
+
+	* 25242: Mikael: Doc/Zsh/prompt.yo, Src/prompt.c: add V prompt
+	test for contents of psvar.
+
 2008-06-23  Peter Stephenson  <pws@csr.com>
 
 	* 25237: Doc/Zsh/tcpsys.yo, Functions/TCP/tcp_open: make
diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo
index d5177346a..54dc3f609 100644
--- a/Doc/Zsh/prompt.yo
+++ b/Doc/Zsh/prompt.yo
@@ -274,6 +274,8 @@ sitem(tt(S))(True if the tt(SECONDS) parameter is at least var(n).)
 sitem(tt(T))(True if the time in hours is equal to var(n).)
 sitem(tt(t))(True if the time in minutes is equal to var(n).)
 sitem(tt(v))(True if the array tt(psvar) has at least var(n) elements.)
+sitem(tt(V))(True if element var(n) of the array tt(psvar) is set and
+non-empty.)
 sitem(tt(w))(True if the day of the week is equal to var(n) (Sunday = 0).)
 endsitem()
 )
diff --git a/Src/prompt.c b/Src/prompt.c
index 034a4fa29..72ba2e244 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -321,6 +321,12 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
 		    if (arrlen(psvar) >= arg)
 			test = 1;
 		    break;
+		case 'V':
+		    if (arrlen(psvar) >= arg) {
+			if (*psvar[(arg ? arg : 1) - 1])
+			    test = 1;
+		    }
+		    break;
 		case '_':
 		    test = (cmdsp >= arg);
 		    break;