mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeys
Problem: CTRL-R CTRL-R doesn't work with modifyOtherKeys. Solution: Allow key codes when fetching argument for CTRL-R. (closes #5266) Also fix CTRL-G in Insert mode.
This commit is contained in:
@@ -3906,6 +3906,7 @@ ins_reg(void)
|
|||||||
* deleted when ESC is hit.
|
* deleted when ESC is hit.
|
||||||
*/
|
*/
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
|
++allow_keys;
|
||||||
regname = plain_vgetc();
|
regname = plain_vgetc();
|
||||||
LANGMAP_ADJUST(regname, TRUE);
|
LANGMAP_ADJUST(regname, TRUE);
|
||||||
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
|
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
|
||||||
@@ -3919,6 +3920,7 @@ ins_reg(void)
|
|||||||
LANGMAP_ADJUST(regname, TRUE);
|
LANGMAP_ADJUST(regname, TRUE);
|
||||||
}
|
}
|
||||||
--no_mapping;
|
--no_mapping;
|
||||||
|
--allow_keys;
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/* Don't call u_sync() while typing the expression or giving an error
|
/* Don't call u_sync() while typing the expression or giving an error
|
||||||
@@ -4010,8 +4012,10 @@ ins_ctrl_g(void)
|
|||||||
* deleted when ESC is hit.
|
* deleted when ESC is hit.
|
||||||
*/
|
*/
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
|
++allow_keys;
|
||||||
c = plain_vgetc();
|
c = plain_vgetc();
|
||||||
--no_mapping;
|
--no_mapping;
|
||||||
|
--allow_keys;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
/* CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col */
|
/* CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col */
|
||||||
|
@@ -1747,6 +1747,7 @@ getcmdline_int(
|
|||||||
#endif
|
#endif
|
||||||
putcmdline('"', TRUE);
|
putcmdline('"', TRUE);
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
|
++allow_keys;
|
||||||
i = c = plain_vgetc(); /* CTRL-R <char> */
|
i = c = plain_vgetc(); /* CTRL-R <char> */
|
||||||
if (i == Ctrl_O)
|
if (i == Ctrl_O)
|
||||||
i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
|
i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
|
||||||
@@ -1754,6 +1755,7 @@ getcmdline_int(
|
|||||||
c = plain_vgetc(); /* CTRL-R CTRL-R <char> */
|
c = plain_vgetc(); /* CTRL-R CTRL-R <char> */
|
||||||
extra_char = NUL;
|
extra_char = NUL;
|
||||||
--no_mapping;
|
--no_mapping;
|
||||||
|
--allow_keys;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/*
|
/*
|
||||||
* Insert the result of an expression.
|
* Insert the result of an expression.
|
||||||
|
@@ -1209,6 +1209,27 @@ func Test_modifyOtherKeys_basic()
|
|||||||
call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
|
call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_modifyOtherKeys_no_mapping()
|
||||||
|
set timeoutlen=10
|
||||||
|
|
||||||
|
let @a = 'aaa'
|
||||||
|
call feedkeys(":let x = '" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a'\<CR>", 'Lx!')
|
||||||
|
call assert_equal("let x = 'aaa'", @:)
|
||||||
|
|
||||||
|
new
|
||||||
|
call feedkeys("a" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a\<Esc>", 'Lx!')
|
||||||
|
call assert_equal("aaa", getline(1))
|
||||||
|
bwipe!
|
||||||
|
|
||||||
|
new
|
||||||
|
call feedkeys("axx\<CR>yy" .. GetEscCodeCSI27('G', 5) .. GetEscCodeCSI27('K', 5) .. "a\<Esc>", 'Lx!')
|
||||||
|
call assert_equal("axx", getline(1))
|
||||||
|
call assert_equal("yy", getline(2))
|
||||||
|
bwipe!
|
||||||
|
|
||||||
|
set timeoutlen&
|
||||||
|
endfunc
|
||||||
|
|
||||||
func RunTest_mapping_shift(key, func)
|
func RunTest_mapping_shift(key, func)
|
||||||
call setline(1, '')
|
call setline(1, '')
|
||||||
if a:key == '|'
|
if a:key == '|'
|
||||||
|
@@ -737,6 +737,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 */
|
||||||
|
/**/
|
||||||
|
2346,
|
||||||
/**/
|
/**/
|
||||||
2345,
|
2345,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user