To: vim_dev@googlegroups.com Subject: Patch 8.2.4551 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4551 Problem: When mapping terminal codes are not recognized. Solution: Specifically recognize a mapping with just and check for terminal codes even though there is no partial mapping. (closes #9903) Files: src/getchar.c, src/testdir/test_termcodes.vim *** ../vim-8.2.4550/src/getchar.c 2022-03-04 19:22:32.713730341 +0000 --- src/getchar.c 2022-03-12 13:41:48.091104099 +0000 *************** *** 2643,2649 **** max_mlen = mlen + 1; } ! if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP) { int save_keylen = keylen; --- 2643,2654 ---- max_mlen = mlen + 1; } ! // May check for a terminal code when there is no mapping or only a partial ! // mapping. Also check if there is a full mapping with , unless timed ! // out, since that is nearly always a partial match with a terminal code. ! if ((mp == NULL || max_mlen > mp_match_len ! || (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout)) ! && keylen != KEYLEN_PART_MAP) { int save_keylen = keylen; *** ../vim-8.2.4550/src/testdir/test_termcodes.vim 2022-03-04 19:22:32.713730341 +0000 --- src/testdir/test_termcodes.vim 2022-03-12 13:40:32.055290647 +0000 *************** *** 2331,2336 **** --- 2331,2352 ---- set timeoutlen& endfunc + func Test_mapping_esc() + set timeoutlen=10 + + new + nnoremap iHello + nnoremap + + call feedkeys(substitute(&t_ku, '\*', '', 'g'), 'Lx!') + call assert_equal("Hello", getline(1)) + + bwipe! + nunmap + nunmap + set timeoutlen& + endfunc + " Test for translation of special key codes (, , etc.) func Test_Keycode_Translation() let keycodes = [ *** ../vim-8.2.4550/src/version.c 2022-03-12 12:21:24.234165379 +0000 --- src/version.c 2022-03-12 13:33:00.604487140 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4551, /**/ -- hundred-and-one symptoms of being an internet addict: 242. You turn down a better-paying job because it doesn't come with a free e-mail account. /// 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 ///