summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-04-12 18:48:35 +0200
committerRobin Jarry <robin@jarry.cc>2023-04-15 17:27:41 +0200
commitc5468febb5552f85c3492070403d97e482670222 (patch)
tree66410ab8ca6d7de0f632c33b6b614cc93d674a9c
parenta9a590a833e2a1616a87b3b9e5fb982ebf8cf1ab (diff)
downloadaerc-c5468febb5552f85c3492070403d97e482670222.tar.gz
aerc-c5468febb5552f85c3492070403d97e482670222.zip
templates: change layered fg & bg color priorities
This is mostly a revert of commit ae4d742c5a90 ("templates: fix layered fg & bg color for inline styles"). As it turns out, context colors (msglist_selected, msglist_marked, msglist_deleted, etc.) need to have priority over inline colors. Otherwise strange and confusing results occur. Reported-by: Skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--doc/aerc-stylesets.7.scd13
-rw-r--r--lib/parse/ansi.go4
2 files changed, 8 insertions, 9 deletions
diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd
index 7e4313c7..218813fe 100644
--- a/doc/aerc-stylesets.7.scd
+++ b/doc/aerc-stylesets.7.scd
@@ -178,13 +178,12 @@ Example:
red.fg=red
```
-User styles have priority over every other styles applied to the context in
-which they are rendered. However, they are layered on top of the context style
-using some form of "transparency". Only the defined colors (fg and/or bg) will
-override the underlying style. Other boolean attributes will be merged with the
-underlying style boolean attributes.
+User styles are layered with other styles applied to the context in which they
+are rendered. The user style colors (fg and/or bg) will only be effective if the
+context style does not define any. Other boolean attributes will be merged with
+the underlying style boolean attributes.
-For example, if the underlying/context style is:
+For example, if the context style is:
fg=red bold
@@ -194,7 +193,7 @@ And the inline style is:
The effective style will be:
- fg=yellow bold italic underline
+ fg=red bold italic underline
# FNMATCH STYLE WILDCARD MATCHING
diff --git a/lib/parse/ansi.go b/lib/parse/ansi.go
index 11424cc5..ff44f8ba 100644
--- a/lib/parse/ansi.go
+++ b/lib/parse/ansi.go
@@ -244,10 +244,10 @@ func (rb *RuneBuffer) ApplyAttrs(style tcell.Style) {
fg, bg, attrs := style.Decompose()
for _, sr := range rb.buf {
srFg, srBg, srAttrs := sr.Style.Decompose()
- if srFg == tcell.ColorDefault {
+ if fg != tcell.ColorDefault {
srFg = fg
}
- if srBg == tcell.ColorDefault {
+ if bg != tcell.ColorDefault {
srBg = bg
}
sr.Style = sr.Style.Attributes(attrs | srAttrs).