aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-09-11 13:55:43 +0200
committerRobin Jarry <robin@jarry.cc>2023-09-19 16:49:59 +0200
commit20e425406541e3fc7c4decad3da9373d378c7164 (patch)
tree3d4853bc27f0a0d8bd34ff4245bace72586c5b9b
parent320aa2257f5b5f4ef516eccc3ab2bd49b79d0fdb (diff)
downloadaerc-20e425406541e3fc7c4decad3da9373d378c7164.tar.gz
colorize: support trailing comments after values
Strip trailing comments after attribute values in stylesets. Update the test styleset to check it works. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
-rw-r--r--filters/colorize.c2
-rwxr-xr-xfilters/test.sh8
-rw-r--r--filters/vectors/colorize-patch.expected18
-rw-r--r--filters/vectors/colorize-quotes.expected4
4 files changed, 16 insertions, 16 deletions
diff --git a/filters/colorize.c b/filters/colorize.c
index d991cb72..03f0fc75 100644
--- a/filters/colorize.c
+++ b/filters/colorize.c
@@ -337,7 +337,7 @@ static struct {const char *n; struct style *s;} ini_objects[] = {
};
/* object attribute value */
-#define STYLE_LINE_FORMAT "%127[0-9A-Za-z_-].%127[0-9a-zA-Z_-] = %127s"
+#define STYLE_LINE_FORMAT "%127[0-9A-Za-z_-].%127[0-9a-zA-Z_-] = %127[#a-zA-Z0-9]s"
static int parse_styleset(void)
{
diff --git a/filters/test.sh b/filters/test.sh
index c0d9e6cd..16d1438c 100755
--- a/filters/test.sh
+++ b/filters/test.sh
@@ -12,15 +12,15 @@ cat >$style <<EOF
url.fg = red
[viewer]
-url.underline = true
-header.bold= true
+url.underline = true # cxwlkj
+header.bold= true # comment
signature.dim=true
diff_meta.bold =true
diff_chunk.dim= true
invalid . xxx = lkjfdslkjfdsqqqqqlkjdsq
-diff_add.fg=2
+diff_add.fg= #00ff00 # comment
# comment
-diff_del.fg= 1
+diff_del.fg= 1 # comment2
quote_*.fg =6
quote_*.dim=true
quote_1.dim=false
diff --git a/filters/vectors/colorize-patch.expected b/filters/vectors/colorize-patch.expected
index dd04c5b7..fe920990 100644
--- a/filters/vectors/colorize-patch.expected
+++ b/filters/vectors/colorize-patch.expected
@@ -24,12 +24,12 @@ According to scdoc(5), numbered lists start with a period.
-4. *msglist_flagged*
-5. *msglist_deleted*
-6. *msglist_marked*
-+. *msglist_default*
-+. *msglist_unread*
-+. *msglist_read*
-+. *msglist_flagged*
-+. *msglist_deleted*
-+. *msglist_marked*
++. *msglist_default*
++. *msglist_unread*
++. *msglist_read*
++. *msglist_flagged*
++. *msglist_deleted*
++. *msglist_marked*
So, the marked style will override all other msglist styles.
@@ -38,9 +38,9 @@ According to scdoc(5), numbered lists start with a period.
-1. *dirlist_default*
-2. *dirlist_unread*
-3. *dirlist_recent*
-+. *dirlist_default*
-+. *dirlist_unread*
-+. *dirlist_recent*
++. *dirlist_default*
++. *dirlist_unread*
++. *dirlist_recent*
## COLORS
diff --git a/filters/vectors/colorize-quotes.expected b/filters/vectors/colorize-quotes.expected
index 4e1e643c..a5d13e00 100644
--- a/filters/vectors/colorize-quotes.expected
+++ b/filters/vectors/colorize-quotes.expected
@@ -37,12 +37,12 @@ facilisi et pri http:// or https://!
> diff --git a/foo b/foo
> index 4b0fe8dded3a..518b67134639 100644
> --- a/foo
-> +++ b/foo
+> +++ b/foo
> @@ -131,6 +131,83 @@ func pouet() int {
> err := doThis()
> 
> - err2 := doThat()
-> + err2 := notDoThat()
+> + err2 := notDoThat()
> 
> if err != nil || err2 != nil {