To: vim_dev@googlegroups.com Subject: Patch 7.4.1533 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1533 Problem: Using feedkeys() with an empty string disregards 'x' option. Solution: Make 'x' work with an empty string. (Thinca) Files: src/eval.c, src/testdir/test_alot.vim, src/testdir/test_feedkeys.vim *** ../vim-7.4.1532/src/eval.c 2016-03-09 23:14:02.295262008 +0100 --- src/eval.c 2016-03-10 22:12:50.157131273 +0100 *************** *** 11839,11862 **** 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); ! for ( ; *flags != NUL; ++flags) { ! switch (*flags) ! { ! case 'n': remap = FALSE; break; ! case 'm': remap = TRUE; break; ! case 't': typed = TRUE; break; ! case 'i': insert = TRUE; break; ! case 'x': execute = TRUE; break; ! } } } /* Need to escape K_SPECIAL and CSI before putting the string in the * typeahead buffer. */ keys_esc = vim_strsave_escape_csi(keys); --- 11839,11863 ---- return; keys = get_tv_string(&argvars[0]); ! ! if (argvars[1].v_type != VAR_UNKNOWN) { ! flags = get_tv_string_buf(&argvars[1], nbuf); ! for ( ; *flags != NUL; ++flags) { ! switch (*flags) { ! case 'n': remap = FALSE; break; ! case 'm': remap = TRUE; break; ! case 't': typed = TRUE; break; ! case 'i': insert = TRUE; break; ! case 'x': execute = TRUE; break; } } + } + 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); *** ../vim-7.4.1532/src/testdir/test_alot.vim 2016-03-08 17:08:38.562223096 +0100 --- src/testdir/test_alot.vim 2016-03-10 22:11:56.421701489 +0100 *************** *** 5,10 **** --- 5,11 ---- 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 *** ../vim-7.4.1532/src/testdir/test_feedkeys.vim 2016-03-10 22:19:13.757062936 +0100 --- src/testdir/test_feedkeys.vim 2016-03-10 22:16:08.903022957 +0100 *************** *** 0 **** --- 1,10 ---- + " Test feedkeys() function. + + func Test_feedkeys_x_with_empty_string() + new + call feedkeys("ifoo\") + call assert_equal('', getline('.')) + call feedkeys('', 'x') + call assert_equal('foo', getline('.')) + quit! + endfunc *** ../vim-7.4.1532/src/version.c 2016-03-10 21:45:59.558192693 +0100 --- src/version.c 2016-03-10 22:19:20.788988393 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1533, /**/ -- "Making it up? Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it." -- Marvin, the Paranoid Android in Douglas Adams' "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///