Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix .zle.sgr for empty sequences
- X-seq: zsh-workers 52724
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: fix .zle.sgr for empty sequences
- Date: Sat, 09 Mar 2024 23:30:47 +0100
- Archived-at: <https://zsh.org/workers/52724>
- List-id: <zsh-workers.zsh.org>
This fixes .zle.sgr from the new hlgroups module to return "0" when the
sequence is empty. In particular \e[m typically works them same as \e[0m
so we want to return the 0 in that case.
Oliver
diff --git a/Src/Modules/hlgroup.c b/Src/Modules/hlgroup.c
index 6382f3216..9c0aedcf8 100644
--- a/Src/Modules/hlgroup.c
+++ b/Src/Modules/hlgroup.c
@@ -59,6 +59,10 @@ convertattr(char *attrstr, int sgr)
*t = ';';
c++;
}
+ if (t <= s) { /* always return at least "0" */
+ *s = '0';
+ t = s + 1;
+ }
*t = '\0';
len = t - s;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author