aboutsummaryrefslogtreecommitdiffstats
path: root/colorize.c
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2024-08-03 23:00:20 +0200
committerGravatar Steven Schubiger <stsc@refcnt.org> 2024-08-03 23:00:20 +0200
commiteb322687409127e0519f1305ce1763fab10508ce (patch)
tree8c0430cf0e5717f9496bc12ec70492a825f8c827 /colorize.c
parent1d13bd538f5d903213639db98ff1c7268f9a2ea7 (diff)
downloadcolorize-master.tar.gz
colorize-master.tar.bz2
Don't increment rainbow color with partial lineHEADmaster
Diffstat (limited to 'colorize.c')
-rw-r--r--colorize.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/colorize.c b/colorize.c
index 3da2b6c..eb8f7c0 100644
--- a/colorize.c
+++ b/colorize.c
@@ -74,6 +74,7 @@
#define LF 0x01
#define CR 0x02
+#define PARTIAL 0x04
#define COUNT_OF(obj, type) (sizeof (obj) / sizeof (type))
@@ -1376,13 +1377,15 @@ read_print_stream (const char *attr, const struct color **colors, const char *fi
if (feof (stream))
{
if (*line != '\0')
- print_line (attr, colors, line, 0, true);
+ print_line (attr, colors, line, PARTIAL, true);
}
else if (*line != '\0')
{
char *p;
if ((clean || clean_all) && (p = strrchr (line, '\033')))
merge_print_line (line, p, stream);
+ else if (rainbow_fg || rainbow_bg)
+ print_line (attr, colors, line, PARTIAL, true);
else
print_line (attr, colors, line, 0, true);
}
@@ -1625,7 +1628,8 @@ print_line (const char *attr, const struct color **colors, const char *const lin
colors[color_iter] = (struct color *)&tables[color_iter].entries[index];
- rainbow_index = index + 1;
+ if (!(flags & PARTIAL))
+ rainbow_index = index + 1;
}
/* Foreground color code is guaranteed to be set when background color code is present. */