Skip to content

Commit

Permalink
colorize: only colorize real usenet signatures
Browse files Browse the repository at this point in the history
Only consider the start of a signature if a line is exactly "-- " with
a trailing space character.

Signed-off-by: Robin Jarry <[email protected]>
Tested-by: Johannes Thyssen Tishman <[email protected]>
  • Loading branch information
rjarry committed Dec 4, 2023
1 parent 0d98bb7 commit c67723b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions filters/colorize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* Copyright (c) 2023 Robin Jarry */

#include <ctype.h>
#include <errno.h>
#include <fnmatch.h>
#include <getopt.h>
#include <regex.h>
Expand Down Expand Up @@ -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, "@@ ")) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c67723b

Please sign in to comment.