zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix .zle.sgr for empty sequences
@ 2024-03-09 22:30 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2024-03-09 22:30 UTC (permalink / raw)
  To: Zsh workers

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;
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-09 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09 22:30 PATCH: fix .zle.sgr for empty sequences Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).