~rjarry/public-inbox

aerc: colorize: only colorize real usenet signatures v1 PROPOSED

Robin Jarry: 1
 colorize: only colorize real usenet signatures

 1 files changed, 2 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rjarry/public-inbox/patches/47202/mbox | git am -3
Learn more about email & git

[PATCH aerc] colorize: only colorize real usenet signatures Export this patch

Only consider the start of a signature if a line is exactly "-- " with
a trailing space character.

Signed-off-by: Robin Jarry <robin@jarry.cc>
---
 filters/colorize.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/filters/colorize.c b/filters/colorize.c
index cf6b8402ddc0..1c4f8c633e7b 100644
--- a/filters/colorize.c
+++ b/filters/colorize.c
@@ -2,7 +2,6 @@
/* Copyright (c) 2023 Robin Jarry */

#include <ctype.h>
#include <errno.h>
#include <fnmatch.h>
#include <getopt.h>
#include <regex.h>
@@ -657,7 +656,7 @@ static void colorize_line(const char *in)

	switch (state) {
	case DIFF:
		if (!strcmp(in, "--") || !strcmp(in, "-- ")) {
		if (!strcmp(in, "-- ")) {
			state = SIGNATURE;
			signature(in);
		} else if (startswith(in, "@@ ")) {
@@ -686,7 +685,7 @@ static void colorize_line(const char *in)
		if (!regexec(&diff_start_re, in, 8, groups, 0)) {
			state = DIFF;
			print_style(in, &styles.diff_meta);
		} else if (!strcmp(in, "--") || !strcmp(in, "-- ")) {
		} else if (!strcmp(in, "-- ")) {
			state = SIGNATURE;
			signature(in);
		} else {
-- 
2.43.0