mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.0225: mode() does not indicate using CTRL-O from Insert mode
Problem: Mode() does not indicate using CTRL-O from Insert mode. Solution: Add "niI", "niR" and "niV" to mode() result. (closes #3000)
This commit is contained in:
@@ -6224,32 +6224,38 @@ mode([expr]) Return a string that indicates the current mode.
|
|||||||
a non-empty String (|non-zero-arg|), then the full mode is
|
a non-empty String (|non-zero-arg|), then the full mode is
|
||||||
returned, otherwise only the first letter is returned.
|
returned, otherwise only the first letter is returned.
|
||||||
|
|
||||||
n Normal, Terminal-Normal
|
n Normal, Terminal-Normal
|
||||||
no Operator-pending
|
no Operator-pending
|
||||||
v Visual by character
|
niI Normal using |i_CTRL-O| in |Insert-mode|
|
||||||
V Visual by line
|
niR Normal using |i_CTRL-O| in |Replace-mode|
|
||||||
CTRL-V Visual blockwise
|
niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
|
||||||
s Select by character
|
v Visual by character
|
||||||
S Select by line
|
V Visual by line
|
||||||
CTRL-S Select blockwise
|
CTRL-V Visual blockwise
|
||||||
i Insert
|
s Select by character
|
||||||
ic Insert mode completion |compl-generic|
|
S Select by line
|
||||||
ix Insert mode |i_CTRL-X| completion
|
CTRL-S Select blockwise
|
||||||
R Replace |R|
|
i Insert
|
||||||
Rc Replace mode completion |compl-generic|
|
ic Insert mode completion |compl-generic|
|
||||||
Rv Virtual Replace |gR|
|
ix Insert mode |i_CTRL-X| completion
|
||||||
Rx Replace mode |i_CTRL-X| completion
|
R Replace |R|
|
||||||
c Command-line editing
|
Rc Replace mode completion |compl-generic|
|
||||||
cv Vim Ex mode |gQ|
|
Rv Virtual Replace |gR|
|
||||||
ce Normal Ex mode |Q|
|
Rx Replace mode |i_CTRL-X| completion
|
||||||
r Hit-enter prompt
|
c Command-line editing
|
||||||
rm The -- more -- prompt
|
cv Vim Ex mode |gQ|
|
||||||
r? A |:confirm| query of some sort
|
ce Normal Ex mode |Q|
|
||||||
! Shell or external command is executing
|
r Hit-enter prompt
|
||||||
t Terminal-Job mode: keys go to the job
|
rm The -- more -- prompt
|
||||||
|
r? A |:confirm| query of some sort
|
||||||
|
! Shell or external command is executing
|
||||||
|
t Terminal-Job mode: keys go to the job
|
||||||
This is useful in the 'statusline' option or when used
|
This is useful in the 'statusline' option or when used
|
||||||
with |remote_expr()| In most other places it always returns
|
with |remote_expr()| In most other places it always returns
|
||||||
"c" or "n".
|
"c" or "n".
|
||||||
|
Note that in the future more modes and more specific modes may
|
||||||
|
be added. It's better not to compare the whole string but only
|
||||||
|
the leading character(s).
|
||||||
Also see |visualmode()|.
|
Also see |visualmode()|.
|
||||||
|
|
||||||
mzeval({expr}) *mzeval()*
|
mzeval({expr}) *mzeval()*
|
||||||
|
@@ -8366,10 +8366,9 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
|
|||||||
static void
|
static void
|
||||||
f_mode(typval_T *argvars, typval_T *rettv)
|
f_mode(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
char_u buf[3];
|
char_u buf[4];
|
||||||
|
|
||||||
buf[1] = NUL;
|
vim_memset(buf, 0, sizeof(buf));
|
||||||
buf[2] = NUL;
|
|
||||||
|
|
||||||
if (time_for_testing == 93784)
|
if (time_for_testing == 93784)
|
||||||
{
|
{
|
||||||
@@ -8435,6 +8434,12 @@ f_mode(typval_T *argvars, typval_T *rettv)
|
|||||||
buf[0] = 'n';
|
buf[0] = 'n';
|
||||||
if (finish_op)
|
if (finish_op)
|
||||||
buf[1] = 'o';
|
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
|
/* Clear out the minor mode when the argument is not a non-zero number or
|
||||||
|
@@ -464,6 +464,18 @@ func Test_mode()
|
|||||||
call assert_equal('n', mode(0))
|
call assert_equal('n', mode(0))
|
||||||
call assert_equal('n', mode(1))
|
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?
|
" How to test operator-pending mode?
|
||||||
|
|
||||||
call feedkeys("v", 'xt')
|
call feedkeys("v", 'xt')
|
||||||
|
@@ -798,6 +798,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
225,
|
||||||
/**/
|
/**/
|
||||||
224,
|
224,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user