about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-03-05 00:11:02 +0100
committerOliver Kiddle <opk@zsh.org>2024-03-05 00:11:02 +0100
commit05c7b21e2b30873d002b50b37e2fbd3803d4b608 (patch)
tree70dc55c5c22cb1c245ab4f7d241ce95ca6cc7957 /Src/prompt.c
parent36a2d5cfa49a6b7d699269cb4f22d5f3d0255bc8 (diff)
downloadzsh-05c7b21e2b30873d002b50b37e2fbd3803d4b608.tar.gz
zsh-05c7b21e2b30873d002b50b37e2fbd3803d4b608.tar.xz
zsh-05c7b21e2b30873d002b50b37e2fbd3803d4b608.zip
52646: extend support for highlight groups to completion explanation strings and WATCHFMT
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 7acbe0e47..e10b05215 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -270,7 +270,8 @@ zattrescape(zattr atr, int *len)
 }
 
 /* Parse the argument for %H */
-static char *
+/**/
+mod_export char *
 parsehighlight(char *arg, char endchar, zattr *atr)
 {
     static int entered = 0;
@@ -295,9 +296,9 @@ parsehighlight(char *arg, char endchar, zattr *atr)
     } else
 	*atr = TXT_ERROR;
     if (ep)
-	*ep = endchar;
+	*ep++ = endchar;
     else
-	ep = strchr(arg, '\0') - 1;
+	ep = strchr(arg, '\0');
     entered = 0;
     return ep;
 }
@@ -635,6 +636,7 @@ putpromptchar(int doprint, int endchar)
 	    case 'H':
 		if (bv->fm[1] == '{') {
 		    bv->fm = parsehighlight(bv->fm + 2, '}', &atr);
+		    --bv->fm;
 		    if (atr != TXT_ERROR) {
 			treplaceattrs(atr);
 			applytextattributes(TSC_PROMPT);