diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-07-29 15:34:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-07-29 15:34:26 +0200 |
commit | 612cc3888b136e80485132d9f997ed457dbc5501 (patch) | |
tree | d200810f73b2c0c5626b249c8dbf0384448e19c8 /src | |
parent | 91f84f6e11cd879d43d651c0903d85bff95f0716 (diff) |
patch 8.1.0225: mode() does not indicate using CTRL-O from Insert modev8.1.0225
Problem: Mode() does not indicate using CTRL-O from Insert mode.
Solution: Add "niI", "niR" and "niV" to mode() result. (closes #3000)
Diffstat (limited to 'src')
-rw-r--r-- | src/evalfunc.c | 11 | ||||
-rw-r--r-- | src/testdir/test_functions.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 12eac8d548..40fbf373a4 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -8366,10 +8366,9 @@ f_mkdir(typval_T *argvars, typval_T *rettv) static void f_mode(typval_T *argvars, typval_T *rettv) { - char_u buf[3]; + char_u buf[4]; - buf[1] = NUL; - buf[2] = NUL; + vim_memset(buf, 0, sizeof(buf)); if (time_for_testing == 93784) { @@ -8435,6 +8434,12 @@ f_mode(typval_T *argvars, typval_T *rettv) buf[0] = 'n'; if (finish_op) buf[1] = 'o'; + else if (restart_edit == 'I' || restart_edit == 'R' + || restart_edit == 'V') + { + buf[1] = 'i'; + buf[2] = restart_edit; + } } /* Clear out the minor mode when the argument is not a non-zero number or diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 14181fb0a4..41996bd451 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -464,6 +464,18 @@ func Test_mode() call assert_equal('n', mode(0)) call assert_equal('n', mode(1)) + " i_CTRL-O + exe "normal i\<C-O>:call Save_mode()\<Cr>\<Esc>" + call assert_equal("n-niI", g:current_modes) + + " R_CTRL-O + exe "normal R\<C-O>:call Save_mode()\<Cr>\<Esc>" + call assert_equal("n-niR", g:current_modes) + + " gR_CTRL-O + exe "normal gR\<C-O>:call Save_mode()\<Cr>\<Esc>" + call assert_equal("n-niV", g:current_modes) + " How to test operator-pending mode? call feedkeys("v", 'xt') diff --git a/src/version.c b/src/version.c index ab58a5c179..1aa6448fbb 100644 --- a/src/version.c +++ b/src/version.c @@ -799,6 +799,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 225, +/**/ 224, /**/ 223, |