diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-06-01 12:50:59 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-06-01 22:31:40 +0200 |
commit | edd4752268b266d697be51733599b708e4ae449a (patch) | |
tree | 550ee8be7fe5b6d9f82df1b70643f43f0587147c | |
parent | 5f5514d8742c803e5c0b701e3d6c053624687f70 (diff) | |
download | aerc-edd4752268b266d697be51733599b708e4ae449a.tar.gz |
config: fix multiple dynamic styles
When a user sets multiple dynamic styles, only the first one is applied.
The parsing function is modifying the matching pattern prior to saving
it to the style. When a second occurrence of the same dynamic style is
seen, the patterns don't match because we compare against the raw user
input instead of the modified pattern value. Store the raw user input as
the pattern instead of our modified regex.
Fixes: 2f46f64b0b0b ("styleset: allow dynamic msglist styling")
Reported-by: Drew Devault <sir@cmpwn.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Drew Devault <sir@cmpwn.com>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | config/style.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/config/style.go b/config/style.go index ee171fcb..511cdb3a 100644 --- a/config/style.go +++ b/config/style.go @@ -466,6 +466,10 @@ func (c *StyleConf) update(header, pattern, attr, val string) error { return s.Set(attr, val) } } + s := Style{ + header: header, + pattern: pattern, + } if strings.HasPrefix(pattern, "~") { pattern = pattern[1:] } else { @@ -475,13 +479,10 @@ func (c *StyleConf) update(header, pattern, attr, val string) error { if err != nil { return err } - var s Style err = (&s).Set(attr, val) if err != nil { return err } - s.header = header - s.pattern = pattern s.re = re c.dynamic = append(c.dynamic, s) return nil |