diff options
author | shadmansaleh <shadmansaleh3@gmail.com> | 2021-06-20 18:05:15 +0600 |
---|---|---|
committer | shadmansaleh <shadmansaleh3@gmail.com> | 2021-06-21 07:14:37 +0600 |
commit | b4a216f7ed417e2f1afa321883da1f9fac921aac (patch) | |
tree | 2e7f00782bcabf1a18a006ff1f8897d4fc65e972 /src/nvim/lua/executor.c | |
parent | 997a9c879215bc01a928de3e762955878314ec6a (diff) | |
download | rneovim-b4a216f7ed417e2f1afa321883da1f9fac921aac.tar.gz rneovim-b4a216f7ed417e2f1afa321883da1f9fac921aac.tar.bz2 rneovim-b4a216f7ed417e2f1afa321883da1f9fac921aac.zip |
BugFix: Fix inconsistent verbose message
When a keymap is set from lua currently verbose message says
it's set from line 1. That's incorrect because we don't really know when
it was set. So until proper :verbose support isn't added for sourceing
lua it shouldn't say where it was set at.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index afc387ef38..4d4286354b 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1164,6 +1164,13 @@ static void nlua_typval_exec(const char *lcmd, size_t lcmd_len, int nlua_source_using_linegetter(LineGetter fgetline, void *cookie, char *name) { + const linenr_T save_sourcing_lnum = sourcing_lnum; + const sctx_T save_current_sctx = current_sctx; + current_sctx.sc_sid = SID_STR; + current_sctx.sc_seq = 0; + current_sctx.sc_lnum = 0; + sourcing_lnum = 0; + garray_T ga; char_u *line = NULL; @@ -1174,6 +1181,9 @@ int nlua_source_using_linegetter(LineGetter fgetline, char *code = (char *)ga_concat_strings_sep(&ga, "\n"); size_t len = strlen(code); nlua_typval_exec(code, len, name, NULL, 0, false, NULL); + + sourcing_lnum = save_sourcing_lnum; + current_sctx = save_current_sctx; ga_clear_strings(&ga); xfree(code); return OK; |