diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-09-15 11:32:28 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-09-15 11:32:28 -0600 |
commit | cd16d3df4c2a21ada895a1353712969045e5c728 (patch) | |
tree | ae8c70d352f26ef1809cbacdaf8bfee05036955c | |
parent | 72b03792b6428ca96ca779b53061c6c98f6f930f (diff) | |
download | rneovim-cd16d3df4c2a21ada895a1353712969045e5c728.tar.gz rneovim-cd16d3df4c2a21ada895a1353712969045e5c728.tar.bz2 rneovim-cd16d3df4c2a21ada895a1353712969045e5c728.zip |
eval/userfunc.c: save the repeat_cmdline along with the redo buff
A user function can clobber the repeat_cmdline, which is used to build
the redo buffer, thus, if the redo buffer is saved when calling a
userfunc, so should the repeat_cmdline.
-rw-r--r-- | src/nvim/eval/userfunc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index c46cb6ba5d..7f64b39cd8 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -837,6 +837,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett int started_profiling = false; bool did_save_redo = false; save_redo_T save_redo; + char_u* saved_repeat_cmdline = NULL; // If depth of calling is getting too high, don't execute the function if (depth >= p_mfd) { @@ -849,6 +850,9 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett // Save search patterns and redo buffer. save_search_patterns(); if (!ins_compl_active()) { + if (repeat_cmdline) { + saved_repeat_cmdline = xstrdup(repeat_cmdline); + } saveRedobuff(&save_redo); did_save_redo = true; } @@ -1198,6 +1202,8 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett // restore search patterns and redo buffer if (did_save_redo) { restoreRedobuff(&save_redo); + xfree(repeat_cmdline); + repeat_cmdline = saved_repeat_cmdline; } restore_search_patterns(); } |