about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-03-13 00:35:10 +0100
committerOliver Kiddle <opk@zsh.org>2024-03-13 00:35:10 +0100
commit37f434498eb626a10e3009216afa306e5ae841c6 (patch)
treec987e9fea74653a8c14551b71749ccb28ceb650c
parentea5a5d6ec430cad1a73f3179fcc018c90a315c35 (diff)
downloadzsh-37f434498eb626a10e3009216afa306e5ae841c6.tar.gz
zsh-37f434498eb626a10e3009216afa306e5ae841c6.tar.xz
zsh-37f434498eb626a10e3009216afa306e5ae841c6.zip
52724: fix .zle.sgr for empty sequences
-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;
     }