mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
Merge pull request #4804 from brcolow/vim-7.4.1150
vim-patch:7.4.{1150,1151}
This commit is contained in:
@@ -3174,6 +3174,11 @@ feedkeys({string} [, {mode}]) *feedkeys()*
|
|||||||
if coming from a mapping. This matters for undo,
|
if coming from a mapping. This matters for undo,
|
||||||
opening folds, etc.
|
opening folds, etc.
|
||||||
'i' Insert the string instead of appending (see above).
|
'i' Insert the string instead of appending (see above).
|
||||||
|
'x' Execute commands until typeahead is empty. This is
|
||||||
|
similar to using ":normal!". You can call feedkeys()
|
||||||
|
several times without 'x' and then one time with 'x'
|
||||||
|
(possibly with an empty {string}) to execute all the
|
||||||
|
typeahead.
|
||||||
Return value is always 0.
|
Return value is always 0.
|
||||||
|
|
||||||
filereadable({file}) *filereadable()*
|
filereadable({file}) *filereadable()*
|
||||||
|
@@ -57,6 +57,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
bool remap = true;
|
bool remap = true;
|
||||||
bool insert = false;
|
bool insert = false;
|
||||||
bool typed = false;
|
bool typed = false;
|
||||||
|
bool execute = false;
|
||||||
|
|
||||||
if (keys.size == 0) {
|
if (keys.size == 0) {
|
||||||
return;
|
return;
|
||||||
@@ -68,6 +69,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
case 'm': remap = true; break;
|
case 'm': remap = true; break;
|
||||||
case 't': typed = true; break;
|
case 't': typed = true; break;
|
||||||
case 'i': insert = true; break;
|
case 'i': insert = true; break;
|
||||||
|
case 'x': execute = true; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,8 +88,12 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
|||||||
xfree(keys_esc);
|
xfree(keys_esc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vgetc_busy)
|
if (vgetc_busy) {
|
||||||
typebuf_was_filled = true;
|
typebuf_was_filled = true;
|
||||||
|
}
|
||||||
|
if (execute) {
|
||||||
|
exec_normal(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
|
/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
|
||||||
|
@@ -7857,20 +7857,25 @@ static void ex_stopinsert(exarg_T *eap)
|
|||||||
* "remap" can be REMAP_NONE or REMAP_YES.
|
* "remap" can be REMAP_NONE or REMAP_YES.
|
||||||
*/
|
*/
|
||||||
void exec_normal_cmd(char_u *cmd, int remap, bool silent)
|
void exec_normal_cmd(char_u *cmd, int remap, bool silent)
|
||||||
|
{
|
||||||
|
// Stuff the argument into the typeahead buffer.
|
||||||
|
ins_typebuf(cmd, remap, 0, true, silent);
|
||||||
|
exec_normal(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Execute normal_cmd() until there is no typeahead left.
|
||||||
|
///
|
||||||
|
/// @param was_typed whether or not something was typed
|
||||||
|
void exec_normal(bool was_typed)
|
||||||
{
|
{
|
||||||
oparg_T oa;
|
oparg_T oa;
|
||||||
|
|
||||||
/*
|
|
||||||
* Stuff the argument into the typeahead buffer.
|
|
||||||
* Execute normal_cmd() until there is no typeahead left.
|
|
||||||
*/
|
|
||||||
clear_oparg(&oa);
|
clear_oparg(&oa);
|
||||||
finish_op = FALSE;
|
finish_op = false;
|
||||||
ins_typebuf(cmd, remap, 0, TRUE, silent);
|
while ((!stuff_empty() || ((was_typed || !typebuf_typed())
|
||||||
while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
|
&& typebuf.tb_len > 0)) && !got_int) {
|
||||||
&& !got_int) {
|
|
||||||
update_topline_cursor();
|
update_topline_cursor();
|
||||||
normal_cmd(&oa, TRUE); /* execute a Normal mode cmd */
|
normal_cmd(&oa, true); // execute a Normal mode cmd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1754,10 +1754,11 @@ static int vgetorpeek(int advance)
|
|||||||
|| ((compl_cont_status & CONT_LOCAL)
|
|| ((compl_cont_status & CONT_LOCAL)
|
||||||
&& (c1 == Ctrl_N || c1 == Ctrl_P)))
|
&& (c1 == Ctrl_N || c1 == Ctrl_P)))
|
||||||
) {
|
) {
|
||||||
if (c1 == K_SPECIAL)
|
if (c1 == K_SPECIAL) {
|
||||||
nolmaplen = 2;
|
nolmaplen = 2;
|
||||||
else {
|
} else {
|
||||||
LANGMAP_ADJUST(c1, (State & (CMDLINE | INSERT)) == 0);
|
LANGMAP_ADJUST(c1, (State & (CMDLINE | INSERT)) == 0
|
||||||
|
&& get_real_state() != SELECTMODE);
|
||||||
nolmaplen = 0;
|
nolmaplen = 0;
|
||||||
}
|
}
|
||||||
/* First try buffer-local mappings. */
|
/* First try buffer-local mappings. */
|
||||||
|
@@ -974,7 +974,7 @@ static int normal_execute(VimState *state, int key)
|
|||||||
s->old_col = curwin->w_curswant;
|
s->old_col = curwin->w_curswant;
|
||||||
s->c = key;
|
s->c = key;
|
||||||
|
|
||||||
LANGMAP_ADJUST(s->c, true);
|
LANGMAP_ADJUST(s->c, get_real_state() != SELECTMODE);
|
||||||
|
|
||||||
// If a mapping was started in Visual or Select mode, remember the length
|
// If a mapping was started in Visual or Select mode, remember the length
|
||||||
// of the mapping. This is used below to not return to Insert mode for as
|
// of the mapping. This is used below to not return to Insert mode for as
|
||||||
|
@@ -36,6 +36,7 @@ SCRIPTS := \
|
|||||||
NEW_TESTS = \
|
NEW_TESTS = \
|
||||||
test_cursor_func.res \
|
test_cursor_func.res \
|
||||||
test_help_tagjump.res \
|
test_help_tagjump.res \
|
||||||
|
test_langmap.res \
|
||||||
test_menu.res \
|
test_menu.res \
|
||||||
test_syntax.res \
|
test_syntax.res \
|
||||||
test_timers.res \
|
test_timers.res \
|
||||||
|
24
src/nvim/testdir/test_langmap.vim
Normal file
24
src/nvim/testdir/test_langmap.vim
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
" tests for 'langmap'
|
||||||
|
|
||||||
|
func Test_langmap()
|
||||||
|
new
|
||||||
|
set langmap=}l,^x,%v
|
||||||
|
|
||||||
|
call setline(1, ['abc'])
|
||||||
|
call feedkeys('gg0}^', 'tx')
|
||||||
|
call assert_equal('ac', getline(1))
|
||||||
|
|
||||||
|
" in Replace mode
|
||||||
|
" need silent! to avoid a delay when entering Insert mode
|
||||||
|
call setline(1, ['abcde'])
|
||||||
|
silent! call feedkeys("gg0lR%{z\<Esc>00", 'tx')
|
||||||
|
call assert_equal('a%{ze', getline(1))
|
||||||
|
|
||||||
|
" in Select mode
|
||||||
|
" need silent! to avoid a delay when entering Insert mode
|
||||||
|
call setline(1, ['abcde'])
|
||||||
|
silent! call feedkeys("gg0}%}\<C-G>}^\<Esc>00", 'tx')
|
||||||
|
call assert_equal('a}^de', getline(1))
|
||||||
|
|
||||||
|
quit!
|
||||||
|
endfunc
|
@@ -542,8 +542,8 @@ static int included_patches[] = {
|
|||||||
// 1154 NA
|
// 1154 NA
|
||||||
// 1153,
|
// 1153,
|
||||||
// 1152 NA
|
// 1152 NA
|
||||||
// 1151,
|
1151,
|
||||||
// 1150,
|
1150,
|
||||||
1149,
|
1149,
|
||||||
// 1148 NA
|
// 1148 NA
|
||||||
// 1147,
|
// 1147,
|
||||||
|
Reference in New Issue
Block a user