about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;