about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 81ed47a30..8b658883f 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -543,18 +543,10 @@ putpromptchar(int doprint, int endchar)
 			if (ztrftime(bp, t0, tmfmt, tm) >= 0)
 			    break;
 		    }
-		    /* 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;
-		    }
+		    /* There is enough room for this because addbufspc(t0)
+		     * allocates room for t0 * 2 bytes. */
+		    metafy(bp, -1, META_NOALLOC);
+		    bp += strlen(bp);
 		    free(tmbuf);
 		    tmbuf = NULL;
 		    break;