about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/Modules/hlgroup.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a2609a1cf..f136bc6b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-03-13  Oliver Kiddle  <opk@zsh.org>
+
+	* 52724: Src/Modules/hlgroup.c: fix .zle.sgr for empty sequences
+
 2024-03-09  Bart Schaefer  <schaefer@zsh.org>
 
 	* 52725: Src/Modules/ksh93.c: updated named reference semantics
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;
     }