aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2023-04-27 09:57:37 -0400
committerRobin Jarry <robin@jarry.cc>2023-05-16 13:41:41 +0200
commitd2ea1aac09fbf02873c3070cadef4386196bb040 (patch)
tree467a77462082f2fc05972517bf88afd200f0c008
parentbbb9b0695e1b8a0962423f5223a4b559b4ef02f6 (diff)
downloadaerc-d2ea1aac09fbf02873c3070cadef4386196bb040.tar.gz
colorize: style chunk function name
It's nice to use a different style for the chunk's function name to make it clear that the name is not necessarily adjacent to the chunk's actual lines. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--CHANGELOG.md4
-rw-r--r--doc/aerc-stylesets.7.scd2
-rw-r--r--filters/colorize.c7
-rw-r--r--filters/vectors/colorize-patch.expected2
4 files changed, 13 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0404164f..b293b869 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased](https://git.sr.ht/~rjarry/aerc/log/master)
+### Added
+
+- Colorize can style diff chunk function names with `diff_chunk_func`.
+
## [0.15.2](https://git.sr.ht/~rjarry/aerc/refs/0.15.2) - 2023-05-11
### Fixed
diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd
index 218813fe..12aa97b6 100644
--- a/doc/aerc-stylesets.7.scd
+++ b/doc/aerc-stylesets.7.scd
@@ -151,6 +151,8 @@ declared under a *[viewer]* section of the styleset file.
: Patch diff meta lines.
| *diff_chunk*
: Patch diff chunks.
+| *diff_chunk_func*
+: Patch diff chunk function names.
| *diff_add*
: Patch diff added lines.
| *diff_del*
diff --git a/filters/colorize.c b/filters/colorize.c
index 1c979d11..6f988158 100644
--- a/filters/colorize.c
+++ b/filters/colorize.c
@@ -144,6 +144,7 @@ struct styles {
struct style signature;
struct style diff_meta;
struct style diff_chunk;
+ struct style diff_chunk_func;
struct style diff_add;
struct style diff_del;
struct style quote_1;
@@ -160,7 +161,8 @@ static struct styles styles = {
.header = { .bold = true, .fg = { .type = RGB, .rgb = 0xaf87ff } },
.signature = { .dim = true, .fg = { .type = RGB, .rgb = 0xaf87ff } },
.diff_meta = { .bold = true, .fg = { .type = RGB, .rgb = 0xffffff } },
- .diff_chunk = { .fg = { .type = RGB, .rgb = 0x00cdcd } },
+ .diff_chunk = { .bold = true, .fg = { .type = RGB, .rgb = 0x00cdcd } },
+ .diff_chunk_func = { .fg = { .type = RGB, .rgb = 0x00cdcd } },
.diff_add = { .fg = { .type = RGB, .rgb = 0x00cd00 } },
.diff_del = { .fg = { .type = RGB, .rgb = 0xcd0000 } },
.quote_1 = { .fg = { .type = RGB, .rgb = 0x5fafff } },
@@ -322,6 +324,7 @@ static struct {const char *n; struct style *s;} ini_objects[] = {
{"signature", &styles.signature},
{"diff_meta", &styles.diff_meta},
{"diff_chunk", &styles.diff_chunk},
+ {"diff_chunk_func", &styles.diff_chunk_func},
{"diff_add", &styles.diff_add},
{"diff_del", &styles.diff_del},
{"quote_1", &styles.quote_1},
@@ -441,7 +444,9 @@ static void diff_chunk(const char *in)
len++;
in += print_notabs(in, len);
print(RESET);
+ print(seq(&styles.diff_chunk_func));
print_notabs(in, BUFSIZ);
+ print(RESET);
}
static inline bool isurichar(char c)
diff --git a/filters/vectors/colorize-patch.expected b/filters/vectors/colorize-patch.expected
index e9124672..733f7628 100644
--- a/filters/vectors/colorize-patch.expected
+++ b/filters/vectors/colorize-patch.expected
@@ -14,7 +14,7 @@ According to scdoc(5), numbered lists start with a period.
index d82ba7cf8163..34bbf4af0fc5 100644
--- a/doc/aerc-stylesets.7.scd
+++ b/doc/aerc-stylesets.7.scd
-@@ -180,20 +180,20 @@ that style applies, unless overridden by a higher layer.
+@@ -180,20 +180,20 @@ that style applies, unless overridden by a higher layer.
The order that *msglist_\** styles are applied in is, from first to last: