diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-15 08:28:20 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-15 10:14:53 +0800 |
commit | 9ab9eb1220113d247dd1eb089cb6576a135b8699 (patch) | |
tree | d3b03ad0d09022a99f2adc006881a93ed0ebe670 /src | |
parent | d6a6adf7082909d555914d85cac0a47d218d7b64 (diff) | |
download | rneovim-9ab9eb1220113d247dd1eb089cb6576a135b8699.tar.gz rneovim-9ab9eb1220113d247dd1eb089cb6576a135b8699.tar.bz2 rneovim-9ab9eb1220113d247dd1eb089cb6576a135b8699.zip |
fix(source): make changing 'shellslash' change expand() result
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/lua/executor.c | 2 | ||||
-rw-r--r-- | src/nvim/runtime.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 2e5b411fad..a86f23db8e 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1906,7 +1906,7 @@ void nlua_set_sctx(sctx_T *current) break; } char *source_path = fix_fname(info->source + 1); - get_current_script_id((char_u *)source_path, current); + get_current_script_id(&source_path, current); xfree(source_path); current->sc_lnum = info->currentline; current->sc_seq = -1; diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 044294f3b0..4eb38c2c9e 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1964,7 +1964,7 @@ int do_source(char *fname, int check_other, int is_vimrc) save_funccal(&funccalp_entry); const sctx_T save_current_sctx = current_sctx; - si = get_current_script_id((char_u *)fname_exp, ¤t_sctx); + si = get_current_script_id(&fname_exp, ¤t_sctx); if (l_do_profiling == PROF_YES) { bool forceit = false; @@ -2077,9 +2077,9 @@ theend: /// Check if fname was sourced before to finds its SID. /// If it's new, generate a new SID. /// -/// @param[in] fname file path of script -/// @param[out] ret_sctx sctx of this script -scriptitem_T *get_current_script_id(char_u *fname, sctx_T *ret_sctx) +/// @param[in,out] fnamep pointer to file path of script +/// @param[out] ret_sctx sctx of this script +scriptitem_T *get_current_script_id(char **fnamep, sctx_T *ret_sctx) { static int last_current_SID_seq = 0; @@ -2096,13 +2096,14 @@ scriptitem_T *get_current_script_id(char_u *fname, sctx_T *ret_sctx) // - If a script is deleted and another script is written, with a // different name, the inode may be re-used. si = &SCRIPT_ITEM(script_sctx.sc_sid); - if (si->sn_name != NULL && FNAMECMP(si->sn_name, fname) == 0) { + if (si->sn_name != NULL && FNAMECMP(si->sn_name, *fnamep) == 0) { // Found it! break; } } if (script_sctx.sc_sid == 0) { - si = new_script_item((char *)vim_strsave(fname), &script_sctx.sc_sid); + si = new_script_item(*fnamep, &script_sctx.sc_sid); + *fnamep = xstrdup((char *)si->sn_name); } if (ret_sctx != NULL) { *ret_sctx = script_sctx; |