vim-patch:9.1.1305: completion menu active after switching windows/tabs (#33488)

Problem:  When switching to another window or tab page while the
          completion menu is active, the menu stays visible, although it
          belongs to the previous window/tab page context (Evgeni
          Chasnovski).
Solution: Track the window and tab page where completion started. Detect
          changes in the main editing loop and cancel completion mode if
          the current window or tab page differs from where completion
          started.

fixes: vim/vim#17090
closes: vim/vim#17101

cf7f01252f

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-04-16 07:50:08 +08:00
committed by GitHub
parent d2d1b5e944
commit b0f97177d4
4 changed files with 268 additions and 23 deletions

View File

@@ -381,6 +381,12 @@ static int insert_check(VimState *state)
did_cursorhold = false;
}
// Check if we need to cancel completion mode because the window
// or tab page was changed
if (ins_compl_active() && !ins_compl_win_active(curwin)) {
ins_compl_cancel();
}
// If the cursor was moved we didn't just insert a space
if (arrow_used) {
s->inserted_space = false;