Patch 8.2.4848
Problem:    Local completion with mappings and simplification not working.
Solution:   Fix local completion <C-N>/<C-P> 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> (C-P)
+   inoremap <C-N> (C-N)
+   normal! G
+   call feedkeys("o\<C-X>\<C-N>\<C-N>\<C-N>\<C-P>\<C-N>\<C-Y>", 'tx')
+   call assert_equal('baz', getline('.'))
+   " Also test with unsimplified keys
+   call feedkeys("o\<C-X>\<*C-N>\<*C-N>\<*C-N>\<*C-P>\<*C-N>\<C-Y>", 'tx')
+   call assert_equal('baz', getline('.'))
+   iunmap <C-P>
+   iunmap <C-N>
+   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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220430140325.CD6851C1918%40moolenaar.net.

Raspunde prin e-mail lui