diff options
author | Robin Jarry <robin@jarry.cc> | 2023-09-11 13:55:43 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-09-19 16:49:59 +0200 |
commit | 20e425406541e3fc7c4decad3da9373d378c7164 (patch) | |
tree | 3d4853bc27f0a0d8bd34ff4245bace72586c5b9b | |
parent | 320aa2257f5b5f4ef516eccc3ab2bd49b79d0fdb (diff) | |
download | aerc-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.c | 2 | ||||
-rwxr-xr-x | filters/test.sh | 8 | ||||
-rw-r--r-- | filters/vectors/colorize-patch.expected | 18 | ||||
-rw-r--r-- | filters/vectors/colorize-quotes.expected | 4 |
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. [31m-4. *msglist_flagged*[0m [31m-5. *msglist_deleted*[0m [31m-6. *msglist_marked*[0m -[32m+. *msglist_default*[0m -[32m+. *msglist_unread*[0m -[32m+. *msglist_read*[0m -[32m+. *msglist_flagged*[0m -[32m+. *msglist_deleted*[0m -[32m+. *msglist_marked*[0m +[38;2;0;255;0m+. *msglist_default*[0m +[38;2;0;255;0m+. *msglist_unread*[0m +[38;2;0;255;0m+. *msglist_read*[0m +[38;2;0;255;0m+. *msglist_flagged*[0m +[38;2;0;255;0m+. *msglist_deleted*[0m +[38;2;0;255;0m+. *msglist_marked*[0m So, the marked style will override all other msglist styles. @@ -38,9 +38,9 @@ According to scdoc(5), numbered lists start with a period. [31m-1. *dirlist_default*[0m [31m-2. *dirlist_unread*[0m [31m-3. *dirlist_recent*[0m -[32m+. *dirlist_default*[0m -[32m+. *dirlist_unread*[0m -[32m+. *dirlist_recent*[0m +[38;2;0;255;0m+. *dirlist_default*[0m +[38;2;0;255;0m+. *dirlist_unread*[0m +[38;2;0;255;0m+. *dirlist_recent*[0m ## 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://! [0m> [1mdiff --git a/foo b/foo[0m [0m> [1mindex 4b0fe8dded3a..518b67134639 100644[0m [0m> [0m[31m--- a/foo[0m -[0m> [0m[32m+++ b/foo[0m +[0m> [0m[38;2;0;255;0m+++ b/foo[0m [0m> @@ -131,6 +131,83 @@ func pouet() int {[0m [0m> err := doThis()[0m [0m> [0m [0m> [0m[31m- err2 := doThat()[0m -[0m> [0m[32m+ err2 := notDoThat()[0m +[0m> [0m[38;2;0;255;0m+ err2 := notDoThat()[0m [0m> [0m [0m> if err != nil || err2 != nil {[0m |