mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0683: mode() returns wrong value with <Cmd> mapping
Problem: mode() returns wrong value with <Cmd> mapping Solution: Change decision priority of VIsual_active and move visual mode a bit further down (kuuote) closes: #15533 Signed-off-by: kuuote <znmxodq1@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
3840d2feaf
commit
0fd1cb1b1f
22
src/misc1.c
22
src/misc1.c
@ -678,17 +678,6 @@ get_mode(char_u *buf)
|
|||||||
buf[i++] = 't';
|
buf[i++] = 't';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (VIsual_active)
|
|
||||||
{
|
|
||||||
if (VIsual_select)
|
|
||||||
buf[i++] = VIsual_mode + 's' - 'v';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf[i++] = VIsual_mode;
|
|
||||||
if (restart_VIsual_select)
|
|
||||||
buf[i++] = 's';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (State == MODE_HITRETURN || State == MODE_ASKMORE
|
else if (State == MODE_HITRETURN || State == MODE_ASKMORE
|
||||||
|| State == MODE_SETWSIZE
|
|| State == MODE_SETWSIZE
|
||||||
|| State == MODE_CONFIRM)
|
|| State == MODE_CONFIRM)
|
||||||
@ -731,6 +720,17 @@ get_mode(char_u *buf)
|
|||||||
if ((State & MODE_CMDLINE) && cmdline_overstrike())
|
if ((State & MODE_CMDLINE) && cmdline_overstrike())
|
||||||
buf[i++] = 'r';
|
buf[i++] = 'r';
|
||||||
}
|
}
|
||||||
|
else if (VIsual_active)
|
||||||
|
{
|
||||||
|
if (VIsual_select)
|
||||||
|
buf[i++] = VIsual_mode + 's' - 'v';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf[i++] = VIsual_mode;
|
||||||
|
if (restart_VIsual_select)
|
||||||
|
buf[i++] = 's';
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf[i++] = 'n';
|
buf[i++] = 'n';
|
||||||
|
@ -923,6 +923,10 @@ func Test_mode()
|
|||||||
call feedkeys("gQ\<Insert>\<F2>vi\<CR>", 'xt')
|
call feedkeys("gQ\<Insert>\<F2>vi\<CR>", 'xt')
|
||||||
call assert_equal("c-cvr", g:current_modes)
|
call assert_equal("c-cvr", g:current_modes)
|
||||||
|
|
||||||
|
" Commandline mode in Visual mode should return "c-c", never "v-v".
|
||||||
|
call feedkeys("v\<Cmd>call input('')\<CR>\<F2>\<CR>\<Esc>", 'xt')
|
||||||
|
call assert_equal("c-c", g:current_modes)
|
||||||
|
|
||||||
" Executing commands in Vim Ex mode should return "cv", never "cvr",
|
" Executing commands in Vim Ex mode should return "cv", never "cvr",
|
||||||
" as Cmdline editing has already ended.
|
" as Cmdline editing has already ended.
|
||||||
call feedkeys("gQcall Save_mode()\<CR>vi\<CR>", 'xt')
|
call feedkeys("gQcall Save_mode()\<CR>vi\<CR>", 'xt')
|
||||||
|
@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
683,
|
||||||
/**/
|
/**/
|
||||||
682,
|
682,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user