summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-04 11:40:12 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-04 11:40:12 +0100
commitcce713ddcc0c9ab29926c28e287cbb587a959b08 (patch)
treeb038987ac55e7d42c33d00c88e71e0d1eb750add
parent975880b6e6de473b512995ef87ce072aaca934cf (diff)
downloadvim-git-cce713ddcc0c9ab29926c28e287cbb587a959b08.tar.gz
patch 8.1.0992: a :normal command resets the reg_executing() resultv8.1.0992
Problem: A :normal command while executing a register resets the reg_executing() result. Solution: Save and restore reg_executing. (closes #4066)
-rw-r--r--src/ex_docmd.c2
-rw-r--r--src/structs.h23
-rw-r--r--src/testdir/test_functions.vim9
-rw-r--r--src/version.c2
4 files changed, 25 insertions, 11 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6e61cca9b..f30d9336a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10260,6 +10260,7 @@ save_current_state(save_state_T *sst)
sst->save_insertmode = p_im;
sst->save_finish_op = finish_op;
sst->save_opcount = opcount;
+ sst->save_reg_executing = reg_executing;
msg_scroll = FALSE; /* no msg scrolling in Normal mode */
restart_edit = 0; /* don't go to Insert mode */
@@ -10285,6 +10286,7 @@ restore_current_state(save_state_T *sst)
p_im = sst->save_insertmode;
finish_op = sst->save_finish_op;
opcount = sst->save_opcount;
+ reg_executing = sst->save_reg_executing;
msg_didout |= sst->save_msg_didout; /* don't reset msg_didout now */
/* Restore the state (needed when called from a function executed for
diff --git a/src/structs.h b/src/structs.h
index ab84eaeaa..6aeed891e 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -2625,19 +2625,19 @@ typedef struct w_line
*/
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 */
@@ -3527,6 +3527,7 @@ typedef struct {
int save_insertmode;
int save_finish_op;
int save_opcount;
+ int save_reg_executing;
tasave_T tabuf;
} save_state_T;
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index a7caf2240..43c0f63c2 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1137,6 +1137,15 @@ func Test_reg_executing_and_recording()
call feedkeys("q\"\"=s:save_reg_stat()\<CR>pq", 'xt')
call assert_equal('":', s:reg_stat)
+ " :normal command saves and restores reg_executing
+ 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
+
bwipe!
delfunc s:save_reg_stat
unlet s:reg_stat
diff --git a/src/version.c b/src/version.c
index 1824903a9..4ac981e6a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 992,
+/**/
991,
/**/
990,