patch 9.1.1126: patch 9.1.1121 used a wrong way to handle enter

Commit: 
https://github.com/vim/vim/commit/44180416981000ad0bc5db4686889892e7a05cdd
Author: glepnir <glephun...@gmail.com>
Date:   Thu Feb 20 22:09:48 2025 +0100

    patch 9.1.1126: patch 9.1.1121 used a wrong way to handle enter
    
    Problem:  patch 9.1.1121 used a wrong way to handle enter
    Solution: compl_enter_selects also needs to consider the selected item
              in ins_compl_new_leader() (glepnir)
    
    closes: #16673
    
    Signed-off-by: glepnir <glephun...@gmail.com>
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index f28015602..624165a9b 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2109,7 +2109,7 @@ ins_compl_new_leader(void)
        compl_restarting = FALSE;
     }
 
-    compl_enter_selects = !compl_used_match;
+    compl_enter_selects = !compl_used_match && compl_selected_item != -1;
 
     // Show the popup menu with a different set of matches.
     ins_compl_show_pum();
@@ -2580,10 +2580,6 @@ ins_compl_prep(int c)
 {
     int                retval = FALSE;
     int                prev_mode = ctrl_x_mode;
-    int                handle_enter = FALSE;
-
-    if ((c == CAR || c == NL || c == K_KENTER) && compl_selected_item == -1)
-       handle_enter = TRUE;
 
     // Forget any previous 'special' messages if this is actually
     // a ^X mode key - bar ^R, in which case we wait to see what it gives us.
@@ -2681,14 +2677,7 @@ ins_compl_prep(int c)
        if ((ctrl_x_mode_normal() && c != Ctrl_N && c != Ctrl_P
                                       && c != Ctrl_R && !ins_compl_pum_key(c))
                || ctrl_x_mode == CTRL_X_FINISHED)
-       {
            retval = ins_compl_stop(c, prev_mode, retval);
-           // When it is the Enter key and no selected item, return false, and
-           // continue processing the Enter key to insert a new line in the
-           // edit function.
-           if (retval && handle_enter)
-               retval = FALSE;
-       }
     }
     else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
        // Trigger the CompleteDone event to give scripts a chance to act
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 9ce8bb287..30a917c4d 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -594,7 +594,7 @@ func Test_edit_CTRL_I()
   call assert_equal([include, 'two', ''], getline(1, '$'))
   call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix')
   call assert_equal([include, 'three', ''], getline(1, '$'))
-  call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<C-y>\<esc>", 'tnix')
+  call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
   call assert_equal([include, '', ''], getline(1, '$'))
   bw!
 endfunc
@@ -622,7 +622,7 @@ func Test_edit_CTRL_K()
   %d
   call setline(1, 'A')
   call cursor(1, 1)
-  call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<C-Y>\<esc>", 'tnix')
+  call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
   call assert_equal(['A'], getline(1, '$'))
   %d
   call setline(1, 'A')
diff --git a/src/version.c b/src/version.c
index 8d044d199..61e2d6b0a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1126,
 /**/
     1125,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tlDt0-003AL4-GW%40256bit.org.

Raspunde prin e-mail lui