aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/vim.c9
-rw-r--r--src/nvim/ex_cmds2.c8
-rw-r--r--src/nvim/globals.h1
3 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index ee36ae28e6..95f6de94a4 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -74,12 +74,11 @@ void api_vim_free_all_mem(void)
}
void nvim_source(String command, Error *err)
- FUNC_API_SINCE(5)
+ FUNC_API_SINCE(7)
{
- try_start();
- do_source_str((char_u *)command.data);
- update_screen(VALID);
- try_end(err);
+ try_start();
+ do_source_str((char_u *)command.data);
+ try_end(err);
}
/// Executes an ex-command.
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 904a3d10e5..edfa3fea9a 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1193,7 +1193,7 @@ static void script_dump_profile(FILE *fd)
/// profiled.
bool prof_def_func(void)
{
- if (current_sctx.sc_sid > 0 && current_SID < 999999) {
+ if (current_sctx.sc_sid > 0) {
return SCRIPT_ITEM(current_sctx.sc_sid).sn_pr_force;
}
return false;
@@ -3048,9 +3048,13 @@ int do_source_str(char_u *cmd)
.buf = cmd,
.offset = 0,
};
- current_SID = 999999;
+ const sctx_T save_current_sctx = current_sctx;
+ current_sctx.sc_sid = SID_STR;
+ current_sctx.sc_seq = 0;
+ current_sctx.sc_lnum = 0;
retval = do_cmdline(NULL, get_str_line, (void *)&cookie,
DOCMD_NOWAIT);
+ current_sctx = save_current_sctx;
return retval;
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 15ad6d8767..172c190df2 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -331,6 +331,7 @@ EXTERN int garbage_collect_at_exit INIT(= false);
#define SID_NONE -6 // don't set scriptID
#define SID_LUA -7 // for Lua scripts/chunks
#define SID_API_CLIENT -8 // for API clients
+#define SID_STR -9 // for sourcing a string
// Script CTX being sourced or was sourced to define the current function.
EXTERN sctx_T current_sctx INIT(= { 0 COMMA 0 COMMA 0 });