To: vim_dev@googlegroups.com Subject: Patch 8.2.4203 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4203 Problem: Entering a character with CTRL-V may include modifiers. Solution: Reset "mod_mask" when entering a character with digits after CTRL-V. (closes #9610) Files: src/edit.c, src/testdir/test_edit.vim *** ../vim-8.2.4202/src/edit.c 2022-01-15 18:25:04.661419379 +0000 --- src/edit.c 2022-01-24 15:26:39.136344400 +0000 *************** *** 1909,1914 **** --- 1909,1919 ---- if ((nc == ESC || nc == CSI) && !noReduceKeys) nc = decodeModifyOtherKeys(nc); + if ((mod_mask & ~MOD_MASK_SHIFT) != 0) + // A character with non-Shift modifiers should not be a valid + // character for i_CTRL-V_digit. + break; + #ifdef FEAT_CMDL_INFO if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1) add_to_showcmd(nc); *************** *** 1986,1992 **** --- 1991,2001 ---- --allow_keys; #endif if (nc) + { vungetc(nc); + // A character typed with i_CTRL-V_digit cannot have modifiers. + mod_mask = 0; + } got_int = FALSE; // CTRL-C typed after CTRL-V is not an interrupt return cc; } *** ../vim-8.2.4202/src/testdir/test_edit.vim 2022-01-13 13:08:10.503904435 +0000 --- src/testdir/test_edit.vim 2022-01-24 15:24:57.262264566 +0000 *************** *** 1073,1086 **** endfunc func Test_edit_CTRL_V() ! CheckFeature ebcdic new call setline(1, ['abc']) call cursor(2, 1) " force some redraws set showmode showcmd ! "call test_override_char_avail(1) ! call test_override('ALL', 1) call feedkeys("A\\\\\\\", 'tnix') call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$')) --- 1073,1088 ---- endfunc func Test_edit_CTRL_V() ! CheckNotFeature ebcdic ! new call setline(1, ['abc']) call cursor(2, 1) + " force some redraws set showmode showcmd ! call test_override('char_avail', 1) ! call feedkeys("A\\\\\\\", 'tnix') call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$')) *************** *** 1093,1100 **** set norl endif - call test_override('ALL', 0) set noshowmode showcmd bw! endfunc --- 1095,1113 ---- set norl endif set noshowmode showcmd + call test_override('char_avail', 0) + + " No modifiers should be applied to the char typed using i_CTRL-V_digit. + call feedkeys(":append\\76c\76\\u3c0j\u3c0\\.\", 'tnix') + call assert_equal('LcLπjπ', getline(2)) + + if has('osx') + " A char with a modifier should not be a valid char for i_CTRL-V_digit. + call feedkeys("o\\\\\\\\\\", 'tnix') + call assert_equal('', getline(3)) + endif + bw! endfunc *** ../vim-8.2.4202/src/version.c 2022-01-24 13:54:42.298380706 +0000 --- src/version.c 2022-01-24 15:15:26.716987187 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4203, /**/ -- Men may not be seen publicly in any kind of strapless gown. [real standing law in Florida, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///