aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorshadmansaleh <shadmansaleh3@gmail.com>2021-06-20 18:05:15 +0600
committershadmansaleh <shadmansaleh3@gmail.com>2021-06-21 07:14:37 +0600
commitb4a216f7ed417e2f1afa321883da1f9fac921aac (patch)
tree2e7f00782bcabf1a18a006ff1f8897d4fc65e972 /src/nvim/ex_cmds2.c
parent997a9c879215bc01a928de3e762955878314ec6a (diff)
downloadrneovim-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/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 9abeee47f4..dd9444f837 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2665,7 +2665,8 @@ static void cmd_source_buffer(const exarg_T *eap)
};
if (curbuf != NULL && curbuf->b_fname
&& path_with_extension((const char *)curbuf->b_fname, "lua")) {
- nlua_source_using_linegetter(get_buffer_line, (void *)&cookie, ":source");
+ nlua_source_using_linegetter(get_buffer_line, (void *)&cookie,
+ ":source (no file)");
} else {
source_using_linegetter((void *)&cookie, get_buffer_line,
":source (no file)");
@@ -3002,8 +3003,17 @@ int do_source(char_u *fname, int check_other, int is_vimrc)
}
if (path_with_extension((const char *)fname, "lua")) {
+ // TODO(shadmansaleh): Properly handle :verbose for lua
+ // For now change currennt_sctx before sourcing lua files
+ // So verbose doesn't say everything was done in line 1 since we don't know
+ const sctx_T current_sctx_backup = current_sctx;
+ const linenr_T sourcing_lnum_backup = sourcing_lnum;
+ current_sctx.sc_lnum = 0;
+ sourcing_lnum = 0;
// Source the file as lua
retval = (int)nlua_exec_file((const char *)fname);
+ current_sctx = current_sctx_backup;
+ sourcing_lnum = sourcing_lnum_backup;
} else {
// Call do_cmdline, which will call getsourceline() to get the lines.
do_cmdline(firstline, getsourceline, (void *)&cookie,