diff options
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 38d0e33948..8d846df8b6 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -75,6 +75,8 @@ struct hl_group { uint8_t *sg_rgb_fg_name; ///< RGB foreground color name uint8_t *sg_rgb_bg_name; ///< RGB background color name uint8_t *sg_rgb_sp_name; ///< RGB special color name + + int sg_blend; ///< blend level (0-100 inclusive), -1 if unset }; /// \addtogroup SG_SET @@ -6879,6 +6881,12 @@ void do_highlight(const char *line, const bool forceit, const bool init) } } else if (strcmp(key, "START") == 0 || strcmp(key, "STOP") == 0) { // Ignored for now + } else if (strcmp(key, "BLEND") == 0) { + if (strcmp(arg, "NONE") != 0) { + HL_TABLE()[idx].sg_blend = strtol(arg, NULL, 10); + } else { + HL_TABLE()[idx].sg_blend = -1; + } } else { emsgf(_("E423: Illegal argument: %s"), key_start); error = true; @@ -6993,6 +7001,7 @@ static void highlight_clear(int idx) XFREE_CLEAR(HL_TABLE()[idx].sg_rgb_fg_name); XFREE_CLEAR(HL_TABLE()[idx].sg_rgb_bg_name); XFREE_CLEAR(HL_TABLE()[idx].sg_rgb_sp_name); + HL_TABLE()[idx].sg_blend = -1; // Clear the script ID only when there is no link, since that is not // cleared. if (HL_TABLE()[idx].sg_link == 0) { @@ -7029,6 +7038,9 @@ static void highlight_list_one(const int id) didh = highlight_list_arg(id, didh, LIST_STRING, 0, sgp->sg_rgb_sp_name, "guisp"); + didh = highlight_list_arg(id, didh, LIST_INT, + sgp->sg_blend+1, NULL, "blend"); + if (sgp->sg_link && !got_int) { (void)syn_list_header(didh, 9999, id); didh = true; @@ -7252,6 +7264,7 @@ static void set_hl_attr(int idx) at_en.rgb_fg_color = sgp->sg_rgb_fg_name ? sgp->sg_rgb_fg : -1; at_en.rgb_bg_color = sgp->sg_rgb_bg_name ? sgp->sg_rgb_bg : -1; at_en.rgb_sp_color = sgp->sg_rgb_sp_name ? sgp->sg_rgb_sp : -1; + at_en.hl_blend = sgp->sg_blend; sgp->sg_attr = hl_get_syn_attr(idx+1, at_en); @@ -7377,6 +7390,7 @@ static int syn_add_group(char_u *name) hlgp->sg_rgb_bg = -1; hlgp->sg_rgb_fg = -1; hlgp->sg_rgb_sp = -1; + hlgp->sg_blend = -1; hlgp->sg_name_u = vim_strsave_up(name); return highlight_ga.ga_len; /* ID is index plus one */ |