diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-13 15:46:20 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-14 04:29:44 +0800 |
commit | 3a8b8591477b4802af73436e93bd1283d4bab518 (patch) | |
tree | 78c59e7d1d532e8297aba9424a1b1c5704e23fa7 /src/nvim/eval/userfunc.c | |
parent | de72f9098a7287615dc8bbb6293732ac546f51ac (diff) | |
download | rneovim-3a8b8591477b4802af73436e93bd1283d4bab518.tar.gz rneovim-3a8b8591477b4802af73436e93bd1283d4bab518.tar.bz2 rneovim-3a8b8591477b4802af73436e93bd1283d4bab518.zip |
vim-patch:8.2.0078: expanding <sfile> works differently the second time
Problem: Expanding <sfile> works differently the second time.
Solution: Keep the expanded name when redefining a function. (closes vim/vim#5425)
https://github.com/vim/vim/commit/b9adef79eca6f95bc7376ff3a6a383e436c5d6ea
Diffstat (limited to 'src/nvim/eval/userfunc.c')
-rw-r--r-- | src/nvim/eval/userfunc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index bcd8eb4d4c..83be330592 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -2442,9 +2442,12 @@ void ex_function(exarg_T *eap) fp = NULL; overwrite = true; } else { - // redefine existing function + char_u *exp_name = fp->uf_name_exp; + // redefine existing function, keep the expanded name XFREE_CLEAR(name); + fp->uf_name_exp = NULL; func_clear_items(fp); + fp->uf_name_exp = exp_name; fp->uf_profiling = false; fp->uf_prof_initialized = false; } |