1
0
forked from aniani/vim

patch 7.4.1533

Problem:    Using feedkeys() with an empty string disregards 'x' option.
Solution:   Make 'x' work with an empty string. (Thinca)
This commit is contained in:
Bram Moolenaar
2016-03-10 22:19:53 +01:00
parent 7bffaa9f9b
commit 74c5bbf134
4 changed files with 26 additions and 12 deletions

View File

@@ -11839,8 +11839,7 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
return;
keys = get_tv_string(&argvars[0]);
if (*keys != NUL)
{
if (argvars[1].v_type != VAR_UNKNOWN)
{
flags = get_tv_string_buf(&argvars[1], nbuf);
@@ -11857,6 +11856,8 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
}
}
if (*keys != NUL || execute)
{
/* Need to escape K_SPECIAL and CSI before putting the string in the
* typeahead buffer. */
keys_esc = vim_strsave_escape_csi(keys);

View File

@@ -5,6 +5,7 @@ source test_backspace_opt.vim
source test_cursor_func.vim
source test_delete.vim
source test_expand.vim
source test_feedkeys.vim
source test_file_perm.vim
source test_glob2regpat.vim
source test_join.vim

View File

@@ -0,0 +1,10 @@
" Test feedkeys() function.
func Test_feedkeys_x_with_empty_string()
new
call feedkeys("ifoo\<Esc>")
call assert_equal('', getline('.'))
call feedkeys('', 'x')
call assert_equal('foo', getline('.'))
quit!
endfunc

View File

@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1533,
/**/
1532,
/**/