Skip to content

Commit 47b0d7c

Browse files
committed
Face +a attribute now merges with base +f and +g instead of overriding
The previous logic would just take the new face attributes if it had "final attributes" on, but this is unlikely to be what we want, we most likely want the "final fg" and "final bg" attributes of the base face to be preserved. Fixes #5415
1 parent f91e5d8 commit 47b0d7c

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

doc/pages/faces.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ attributes::
6161
Same as final, but only applies to a face's background color.
6262
*a*:::
6363
final attributes::::
64-
Same as final, but only applies to a face's attributes.
64+
Same as final, but only applies to a face's attributes, note
65+
that this will not clear to the f/g/a attributes of the base
66+
face, so `+a` cannot be used to remove `+f` and/or `+g`
6567

6668
base::
6769
The face onto which other faces apply. Its value can be any face name,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
a <b c> d
2+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
face global Whitespace yellow+f
2+
addhl global/ show-whitespaces -spc .
3+
face global before_underline cyan
4+
face global add_underline ,,magenta+c
5+
face global remove_underline +a
6+
addhl global/a regex <([^>]*)> 1:before_underline
7+
addhl global/b regex [a-z] 0:add_underline
8+
addhl global/c regex <([^>]*)> 1:remove_underline
9+
addhl global/d regex <([^>]*)> 1:before_underline
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ui_out -ignore 1
2+
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "magenta", "attributes": ["curly_underline"] }, "contents": "a" }, { "face": { "fg": "yellow", "bg": "default", "underline": "default", "attributes": ["final_fg"] }, "contents": "." }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "<" }, { "face": { "fg": "cyan", "bg": "default", "underline": "magenta", "attributes": ["final_attr"] }, "contents": "b" }, { "face": { "fg": "yellow", "bg": "default", "underline": "default", "attributes": ["final_fg","final_attr"] }, "contents": "." }, { "face": { "fg": "cyan", "bg": "default", "underline": "magenta", "attributes": ["final_attr"] }, "contents": "c" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": ">" }, { "face": { "fg": "yellow", "bg": "default", "underline": "default", "attributes": ["final_fg"] }, "contents": "." }, { "face": { "fg": "default", "bg": "default", "underline": "magenta", "attributes": ["curly_underline"] }, "contents": "d" }, { "face": { "fg": "yellow", "bg": "default", "underline": "default", "attributes": ["final_fg"] }, "contents": "¬" }], [{ "face": { "fg": "yellow", "bg": "default", "underline": "default", "attributes": ["final_fg"] }, "contents": "¬" }]], { "line": 0, "column": 0 }, { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'

0 commit comments

Comments
 (0)