diff options
author | Andy K. Massimino <f8a663@normed.space> | 2021-03-05 00:03:08 -0500 |
---|---|---|
committer | Andy K. Massimino <f8a663@normed.space> | 2021-03-20 15:56:37 -0400 |
commit | 7e89606591c76efc7587911ff6d9c3414525f2a2 (patch) | |
tree | 307cb6d78d69e90d382519b578cf6375e5777a50 /src/nvim/syntax.c | |
parent | 8601e8b0d628037d253b76de8aa524c6174f4af9 (diff) | |
download | rneovim-7e89606591c76efc7587911ff6d9c3414525f2a2.tar.gz rneovim-7e89606591c76efc7587911ff6d9c3414525f2a2.tar.bz2 rneovim-7e89606591c76efc7587911ff6d9c3414525f2a2.zip |
vim-patch:8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Problem: "verbose hi Name" reports incorrect info after ":hi clear".
Solution: Store the script context. (Antony Scriven, closes vim/vim#6975)
https://github.com/vim/vim/commit/e8df0104985af58ee501a6fbac8ac9f886e84e5a
Also adds src/nvim/testdir/script_util.vim which originates from patch 8.2.1366
(https://github.com/vim/vim/commit/a6296200bd5191bab7efcdcc16c9e79eb498e8e0)
because some tests in test_highlight.vim use it for testing :verbose.
Should merge this and older related patches later.
Also, fix collateral damage to test_options.vim
test_options tests for file name completion in the test directory, but
since we've added a new file, the test output is now different. This
test is slightly different from upstream anyway, so for now we just add
the file name. This may change when more upstream patches are added
which alter this test.
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 9501093e21..d204968c0f 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -61,6 +61,7 @@ struct hl_group { int sg_link; ///< link to this highlight group ID int sg_deflink; ///< default link; restored in highlight_clear() int sg_set; ///< combination of flags in \ref SG_SET + sctx_T sg_deflink_sctx; ///< script where the default link was set sctx_T sg_script_ctx; ///< script in which the group was last set // for terminal UIs int sg_cterm; ///< "cterm=" highlighting attr @@ -6633,6 +6634,8 @@ void do_highlight(const char *line, const bool forceit, const bool init) hlgroup = &HL_TABLE()[from_id - 1]; if (dodefault && (forceit || hlgroup->sg_deflink == 0)) { hlgroup->sg_deflink = to_id; + hlgroup->sg_deflink_sctx = current_sctx; + hlgroup->sg_deflink_sctx.sc_lnum += sourcing_lnum; } } @@ -7114,14 +7117,11 @@ static void highlight_clear(int idx) XFREE_CLEAR(HL_TABLE()[idx].sg_rgb_bg_name); XFREE_CLEAR(HL_TABLE()[idx].sg_rgb_sp_name); HL_TABLE()[idx].sg_blend = -1; - // Restore any default link. + // Restore default link and context if they exist. Otherwise clears. HL_TABLE()[idx].sg_link = HL_TABLE()[idx].sg_deflink; - // 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_script_ctx.sc_sid = 0; - HL_TABLE()[idx].sg_script_ctx.sc_lnum = 0; - } + // Since we set the default link, set the location to where the default + // link was set. + HL_TABLE()[idx].sg_script_ctx = HL_TABLE()[idx].sg_deflink_sctx; } |