about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2006-01-13 09:25:09 +0000
committerWayne Davison <wayned@users.sourceforge.net>2006-01-13 09:25:09 +0000
commit325c9a1de59501ce8412cc8b32913cac30c2ed75 (patch)
tree0dc36babc02ae132931210ad2dadc4863948d160 /Src/prompt.c
parent39b3d2b90a7c394ab2aabc3cd1a21d144265715c (diff)
downloadzsh-325c9a1de59501ce8412cc8b32913cac30c2ed75.tar.gz
zsh-325c9a1de59501ce8412cc8b32913cac30c2ed75.tar.xz
zsh-325c9a1de59501ce8412cc8b32913cac30c2ed75.zip
Metafy the output of the ztrftime() string since that's what the
prompt expects and some date names might not be ASCII.
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index cf0e75adb..81ed47a30 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -543,7 +543,18 @@ putpromptchar(int doprint, int endchar)
 			if (ztrftime(bp, t0, tmfmt, tm) >= 0)
 			    break;
 		    }
-		    bp += strlen(bp);
+		    /* Check if there are any chars to metafy while
+		     * advancing bp to the end of the string. */
+		    for (ss = bp, t0 = 0; *bp; bp++ ) {
+			if (imeta(*bp))
+			    t0++; /* count of Meta chars needed */
+		    }
+		    if (t0) {
+			j = bp - ss; /* unmetafied string length */
+			addbufspc(t0);
+			metafy(bp - j, j, META_NOALLOC);
+			bp += t0;
+		    }
 		    free(tmbuf);
 		    tmbuf = NULL;
 		    break;