diff options
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4b9e84745a..f7de5f00d0 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -60,7 +60,7 @@ struct hl_group { int sg_attr; ///< Screen attr @see ATTR_ENTRY int sg_link; ///< link to this highlight group ID int sg_set; ///< combination of flags in \ref SG_SET - scid_T sg_scriptID; ///< script in which the group was last set + sctx_T sg_script_ctx; ///< script in which the group was last set // for terminal UIs int sg_cterm; ///< "cterm=" highlighting attr ///< (combination of \ref HlAttrFlags) @@ -6565,13 +6565,15 @@ void do_highlight(const char *line, const bool forceit, const bool init) EMSG(_("E414: group has settings, highlight link ignored")); } } else if (HL_TABLE()[from_id - 1].sg_link != to_id - || HL_TABLE()[from_id - 1].sg_scriptID != current_SID + || HL_TABLE()[from_id - 1].sg_script_ctx.sc_sid + != current_sctx.sc_sid || HL_TABLE()[from_id - 1].sg_cleared) { if (!init) { HL_TABLE()[from_id - 1].sg_set |= SG_LINK; } HL_TABLE()[from_id - 1].sg_link = to_id; - HL_TABLE()[from_id - 1].sg_scriptID = current_SID; + HL_TABLE()[from_id - 1].sg_script_ctx = current_sctx; + HL_TABLE()[from_id - 1].sg_script_ctx.sc_lnum += sourcing_lnum; HL_TABLE()[from_id - 1].sg_cleared = false; redraw_all_later(SOME_VALID); @@ -6950,7 +6952,8 @@ void do_highlight(const char *line, const bool forceit, const bool init) } else { set_hl_attr(idx); } - HL_TABLE()[idx].sg_scriptID = current_SID; + HL_TABLE()[idx].sg_script_ctx = current_sctx; + HL_TABLE()[idx].sg_script_ctx.sc_lnum += sourcing_lnum; } xfree(key); xfree(arg); @@ -7034,7 +7037,8 @@ static void highlight_clear(int idx) // Clear the script ID only when there is no link, since that is not // cleared. if (HL_TABLE()[idx].sg_link == 0) { - HL_TABLE()[idx].sg_scriptID = 0; + HL_TABLE()[idx].sg_script_ctx.sc_sid = 0; + HL_TABLE()[idx].sg_script_ctx.sc_lnum = 0; } } @@ -7084,8 +7088,9 @@ static void highlight_list_one(const int id) if (!didh) highlight_list_arg(id, didh, LIST_STRING, 0, (char_u *)"cleared", ""); - if (p_verbose > 0) - last_set_msg(sgp->sg_scriptID); + if (p_verbose > 0) { + last_set_msg(sgp->sg_script_ctx); + } } /// Outputs a highlight when doing ":hi MyHighlight" |