diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-11-16 03:34:25 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-11-16 00:34:25 -0800 |
commit | d79164c9f9ffbb17b82b3a523e217e61f43697be (patch) | |
tree | 689e1d515da7eda3f2676aecb417c7ab1f6287c1 /src | |
parent | e3b08a0fc43eef91b51f8166a036e86b5bdf5613 (diff) | |
download | rneovim-d79164c9f9ffbb17b82b3a523e217e61f43697be.tar.gz rneovim-d79164c9f9ffbb17b82b3a523e217e61f43697be.tar.bz2 rneovim-d79164c9f9ffbb17b82b3a523e217e61f43697be.zip |
vim-patch:8.1.0992: :normal resets reg_executing() result #11398
Problem: A :normal command while executing a register resets the
reg_executing() result.
Solution: Save and restore reg_executing. (closes vim/vim#4066)
https://github.com/vim/vim/commit/cce713ddcc0c9ab29926c28e287cbb587a959b08
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer_defs.h | 22 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 7 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 3b8e5b5632..700d8b82e6 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -918,19 +918,19 @@ typedef struct w_line { * or row (FR_ROW) layout or is a leaf, which has a window. */ struct frame_S { - char fr_layout; /* FR_LEAF, FR_COL or FR_ROW */ + char fr_layout; // FR_LEAF, FR_COL or FR_ROW int fr_width; - int fr_newwidth; /* new width used in win_equal_rec() */ + int fr_newwidth; // new width used in win_equal_rec() int fr_height; - int fr_newheight; /* new height used in win_equal_rec() */ - frame_T *fr_parent; /* containing frame or NULL */ - frame_T *fr_next; /* frame right or below in same parent, NULL - for first */ - frame_T *fr_prev; /* frame left or above in same parent, NULL - for last */ - /* fr_child and fr_win are mutually exclusive */ - frame_T *fr_child; /* first contained frame */ - win_T *fr_win; /* window that fills this frame */ + int fr_newheight; // new height used in win_equal_rec() + frame_T *fr_parent; // containing frame or NULL + frame_T *fr_next; // frame right or below in same parent, NULL + // for last + frame_T *fr_prev; // frame left or above in same parent, NULL + // for first + // fr_child and fr_win are mutually exclusive + frame_T *fr_child; // first contained frame + win_T *fr_win; // window that fills this frame }; #define FR_LEAF 0 /* frame is a leaf */ diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 7d02623d67..6a8bea28a7 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8207,6 +8207,7 @@ static void ex_normal(exarg_T *eap) int save_insertmode = p_im; int save_finish_op = finish_op; long save_opcount = opcount; + const int save_reg_executing = reg_executing; char_u *arg = NULL; int l; char_u *p; @@ -8301,7 +8302,8 @@ static void ex_normal(exarg_T *eap) p_im = save_insertmode; finish_op = save_finish_op; opcount = save_opcount; - msg_didout |= save_msg_didout; /* don't reset msg_didout now */ + reg_executing = save_reg_executing; + msg_didout |= save_msg_didout; // don't reset msg_didout now /* Restore the state (needed when called from a function executed for * 'indentexpr'). Update the mouse and cursor, they may have changed. */ diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index a36c51f56f..7822507f86 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1132,6 +1132,13 @@ func Test_reg_executing_and_recording() " :normal command saves and restores reg_executing let s:reg_stat = '' + let @q = ":call TestFunc()\<CR>:call s:save_reg_stat()\<CR>" + func TestFunc() abort + normal! ia + endfunc + call feedkeys("@q", 'xt') + call assert_equal(':q', s:reg_stat) + delfunc TestFunc " getchar() command saves and restores reg_executing map W :call TestFunc()<CR> |