To: vim_dev@googlegroups.com Subject: Patch 8.2.1930 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1930 Problem: Wrong input if removing shift results in special key code. Solution: Handle special key codes. (closes #7189) Files: src/term.c, src/testdir/test_termcodes.vim *** ../vim-8.2.1929/src/term.c 2020-10-28 20:19:56.376057067 +0100 --- src/term.c 2020-10-31 16:29:06.419779447 +0100 *************** *** 4462,4468 **** if (modifiers != 0) { // Some keys have the modifier included. Need to handle that here to ! // make mappings work. *key = simplify_key(*key, &modifiers); if (modifiers != 0) { --- 4462,4469 ---- if (modifiers != 0) { // Some keys have the modifier included. Need to handle that here to ! // make mappings work. This may result in a special key, such as ! // K_S_TAB. *key = simplify_key(*key, &modifiers); if (modifiers != 0) { *************** *** 4793,4799 **** // insert modifiers with KS_MODIFIER new_slen = modifiers2keycode(modifiers, &key, string); ! if (has_mbyte) new_slen += (*mb_char2bytes)(key, string + new_slen); else string[new_slen++] = key; --- 4794,4806 ---- // insert modifiers with KS_MODIFIER new_slen = modifiers2keycode(modifiers, &key, string); ! if (IS_SPECIAL(key)) ! { ! string[new_slen++] = K_SPECIAL; ! string[new_slen++] = KEY2TERMCAP0(key); ! string[new_slen++] = KEY2TERMCAP1(key); ! } ! else if (has_mbyte) new_slen += (*mb_char2bytes)(key, string + new_slen); else string[new_slen++] = key; *** ../vim-8.2.1929/src/testdir/test_termcodes.vim 2020-10-07 17:28:47.477370289 +0200 --- src/testdir/test_termcodes.vim 2020-10-31 16:28:47.979796927 +0100 *************** *** 2029,2034 **** --- 2029,2051 ---- set timeoutlen& endfunc + " Whether Shift-Tab sends "ESC [ Z" or "ESC [ 27 ; 2 ; 9 ~" is unpredictable, + " both should work. + func Test_modifyOtherKeys_shift_tab() + set timeoutlen=10 + + call setline(1, '') + call feedkeys("a\" .. GetEscCodeCSI27("\t", '2') .. "\", 'Lx!') + eval getline(1)->assert_equal('') + + call setline(1, '') + call feedkeys("a\\[Z\", 'Lx!') + eval getline(1)->assert_equal('') + + set timeoutlen& + bwipe! + endfunc + func RunTest_mapping_works_with_shift(func) new set timeoutlen=10 *** ../vim-8.2.1929/src/version.c 2020-10-31 13:05:08.347282036 +0100 --- src/version.c 2020-10-31 16:32:20.071519165 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1930, /**/ -- hundred-and-one symptoms of being an internet addict: 164. You got out to buy software, instead of going out for a beer. /// 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 ///