diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2022-03-02 00:48:11 +0300 |
---|---|---|
committer | Kirill Chibisov <contact@kchibisov.com> | 2022-03-03 23:35:36 +0300 |
commit | f89fb41a7a8b499159bfa44afa26dd17a845af45 (patch) | |
tree | b5ccba78e1a2a03723a0a4c4c6409ac246224c2f /src/nvim/highlight.c | |
parent | 7211d8ef21cd93365c5f0582c5a0115e84c011ce (diff) | |
download | rneovim-f89fb41a7a8b499159bfa44afa26dd17a845af45.tar.gz rneovim-f89fb41a7a8b499159bfa44afa26dd17a845af45.tar.bz2 rneovim-f89fb41a7a8b499159bfa44afa26dd17a845af45.zip |
feat(tui): add support for `CSI 4 : [2,4,5] m`
This commit finishes support for colored and styled underlines adding
`CSI 4 : [2,4,5] m` support providing double, dashed, and dotted
underlines
Fixes #17362.
Diffstat (limited to 'src/nvim/highlight.c')
-rw-r--r-- | src/nvim/highlight.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index e43a56086f..a01d8369ba 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -558,7 +558,7 @@ int hl_blend_attrs(int back_attr, int front_attr, bool *through) cattrs = battrs; cattrs.rgb_fg_color = rgb_blend(ratio, battrs.rgb_fg_color, fattrs.rgb_bg_color); - if (cattrs.rgb_ae_attr & (HL_UNDERLINE|HL_UNDERCURL)) { + if (cattrs.rgb_ae_attr & (HL_ANY_UNDERLINE)) { cattrs.rgb_sp_color = rgb_blend(ratio, battrs.rgb_sp_color, fattrs.rgb_bg_color); } else { @@ -576,7 +576,7 @@ int hl_blend_attrs(int back_attr, int front_attr, bool *through) } cattrs.rgb_fg_color = rgb_blend(ratio/2, battrs.rgb_fg_color, fattrs.rgb_fg_color); - if (cattrs.rgb_ae_attr & (HL_UNDERLINE|HL_UNDERCURL)) { + if (cattrs.rgb_ae_attr & (HL_ANY_UNDERLINE)) { cattrs.rgb_sp_color = rgb_blend(ratio/2, battrs.rgb_bg_color, fattrs.rgb_sp_color); } else { @@ -743,10 +743,23 @@ Dictionary hlattrs2dict(HlAttrs ae, bool use_rgb) PUT(hl, "underline", BOOLEAN_OBJ(true)); } + if (mask & HL_UNDERLINELINE) { + PUT(hl, "underlineline", BOOLEAN_OBJ(true)); + } + if (mask & HL_UNDERCURL) { PUT(hl, "undercurl", BOOLEAN_OBJ(true)); } + if (mask & HL_UNDERDOT) { + PUT(hl, "underdot", BOOLEAN_OBJ(true)); + } + + if (mask & HL_UNDERDASH) { + PUT(hl, "underdash", BOOLEAN_OBJ(true)); + } + + if (mask & HL_ITALIC) { PUT(hl, "italic", BOOLEAN_OBJ(true)); } @@ -813,7 +826,10 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e CHECK_FLAG(dict, mask, bold, , HL_BOLD); CHECK_FLAG(dict, mask, standout, , HL_STANDOUT); CHECK_FLAG(dict, mask, underline, , HL_UNDERLINE); + CHECK_FLAG(dict, mask, underlineline, , HL_UNDERLINELINE); CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL); + CHECK_FLAG(dict, mask, underdot, , HL_UNDERDOT); + CHECK_FLAG(dict, mask, underdash, , HL_UNDERDASH); CHECK_FLAG(dict, mask, italic, , HL_ITALIC); CHECK_FLAG(dict, mask, reverse, , HL_INVERSE); CHECK_FLAG(dict, mask, strikethrough, , HL_STRIKETHROUGH); |