diff options
author | erw7 <erw7.github@gmail.com> | 2019-08-25 13:45:45 +0900 |
---|---|---|
committer | erw7 <erw7.github@gmail.com> | 2019-09-04 13:40:04 +0900 |
commit | a2e48b556b7537acd26353b6cc201410be7cf3dc (patch) | |
tree | 8608753784910578b9772905f9545bf45c282361 /src/nvim/syntax.c | |
parent | 38806f23edfcba8cb7f7b80039d268ae3ffb0557 (diff) | |
download | rneovim-a2e48b556b7537acd26353b6cc201410be7cf3dc.tar.gz rneovim-a2e48b556b7537acd26353b6cc201410be7cf3dc.tar.bz2 rneovim-a2e48b556b7537acd26353b6cc201410be7cf3dc.zip |
vim-patch:8.1.0362: cannot get the script line number when executing a function
Problem: Cannot get the script line number when executing a function.
Solution: Store the line number besides the script ID. (Ozaki Kiichi,
closes vim/vim#3362) Also display the line number with ":verbose set".
https://github.com/vim/vim/commit/f29c1c6aa3f365c025890fab5fb9efbe88eb1761
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" |