patch 9.1.1540: completion: menu state wrong on interruption

Commit: 
https://github.com/vim/vim/commit/f6a308c65bfe881535ea924028b9386fbd3ba4da
Author: Girish Palya <giris...@gmail.com>
Date:   Sun Jul 13 17:01:57 2025 +0200

    patch 9.1.1540: completion: menu state wrong on interruption
    
    Problem:  completion: menu state wrong on interruption
              (Maxim Kim)
    Solution: Call show_pum() if completion was interrupted
              (Girish Palya).
    
    Popup menu was not built after fuzzy sorting, so internal state wasn't
    reflected on screen.
    
    No test. Couldn't get the terminal test to trigger both interruption and
    refresh together.
    
    fixes: #17725
    closes: #17736
    
    Signed-off-by: Girish Palya <giris...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index 84690e588..e9ace5767 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2395,6 +2395,8 @@ ins_compl_need_restart(void)
 ins_compl_new_leader(void)
 {
     int            cur_cot_flags = get_cot_flags();
+    int            save_w_wrow;
+    int            save_w_leftcol;
 
     ins_compl_del_pum();
     ins_compl_delete();
@@ -2424,8 +2426,10 @@ ins_compl_new_leader(void)
            out_flush_cursor(FALSE, FALSE);
        }
 #endif
+       save_w_wrow = curwin->w_wrow;
+       save_w_leftcol = curwin->w_leftcol;
        compl_restarting = TRUE;
-       if (ins_complete(Ctrl_N, TRUE) == FAIL)
+       if (ins_complete(Ctrl_N, FALSE) == FAIL)
            compl_cont_status = 0;
        compl_restarting = FALSE;
     }
@@ -2451,7 +2455,8 @@ ins_compl_new_leader(void)
     compl_enter_selects = !compl_used_match && compl_selected_item != -1;
 
     // Show the popup menu with a different set of matches.
-    ins_compl_show_pum();
+    if (!compl_interrupted)
+       show_pum(save_w_wrow, save_w_leftcol);
 
     // Don't let Enter select the original text when there is no popup menu.
     if (compl_match_array == NULL)
diff --git a/src/version.c b/src/version.c
index f63b16789..a8c368fed 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1540,
 /**/
     1539,
 /**/

-- 
-- 
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/E1uayPw-003KdC-6S%40256bit.org.

Raspunde prin e-mail lui