To: vim_dev@googlegroups.com Subject: Patch 8.2.4848 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4848 Problem: Local completion with mappings and simplification not working. Solution: Fix local completion / mappings not ignored if keys are not simplified. (closes #10323) Files: src/getchar.c, src/testdir/test_popup.vim *** ../vim-8.2.4847/src/getchar.c 2022-04-29 16:43:56.219178196 +0100 --- src/getchar.c 2022-04-30 14:59:08.332037366 +0100 *************** *** 2342,2351 **** /* * Check if the bytes at the start of the typeahead buffer are a character used ! * in CTRL-X mode. This includes the form with a CTRL modifier. */ static int ! at_ctrl_x_key(void) { char_u *p = typebuf.tb_buf + typebuf.tb_off; int c = *p; --- 2342,2351 ---- /* * Check if the bytes at the start of the typeahead buffer are a character used ! * in Insert mode completion. This includes the form with a CTRL modifier. */ static int ! at_ins_compl_key(void) { char_u *p = typebuf.tb_buf + typebuf.tb_off; int c = *p; *************** *** 2355,2361 **** && p[1] == KS_MODIFIER && (p[2] & MOD_MASK_CTRL)) c = p[3] & 0x1f; ! return vim_is_ctrl_x_key(c); } /* --- 2355,2362 ---- && p[1] == KS_MODIFIER && (p[2] & MOD_MASK_CTRL)) c = p[3] & 0x1f; ! return (ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c)) ! || (compl_status_local() && (c == Ctrl_N || c == Ctrl_P)); } /* *************** *** 2486,2494 **** && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) && State != ASKMORE && State != CONFIRM ! && !((ctrl_x_mode_not_default() && at_ctrl_x_key()) ! || (compl_status_local() ! && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) { #ifdef FEAT_GUI if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2 --- 2487,2493 ---- && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) && State != ASKMORE && State != CONFIRM ! && !at_ins_compl_key()) { #ifdef FEAT_GUI if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2 *** ../vim-8.2.4847/src/testdir/test_popup.vim 2022-02-10 19:51:42.549569899 +0000 --- src/testdir/test_popup.vim 2022-04-30 14:59:08.332037366 +0100 *************** *** 325,330 **** --- 325,345 ---- bwipe! endfunc + func Test_compl_ignore_mappings() + call setline(1, ['foo', 'bar', 'baz', 'foobar']) + inoremap (C-P) + inoremap (C-N) + normal! G + call feedkeys("o\\\\\\\", 'tx') + call assert_equal('baz', getline('.')) + " Also test with unsimplified keys + call feedkeys("o\\<*C-N>\<*C-N>\<*C-N>\<*C-P>\<*C-N>\", 'tx') + call assert_equal('baz', getline('.')) + iunmap + iunmap + bwipe! + endfunc + func DummyCompleteOne(findstart, base) if a:findstart return 0 *** ../vim-8.2.4847/src/version.c 2022-04-29 21:14:58.341192079 +0100 --- src/version.c 2022-04-30 15:02:00.576241098 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4848, /**/ -- You are only young once, but you can stay immature indefinitely. /// 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 ///