To: vim_dev@googlegroups.com Subject: Patch 8.1.0042 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0042 Problem: If omni completion opens a window Insert mode is stopped. (Hirohito Higashi) Solution: Only set stop_insert_mode in a prompt buffer window. Files: src/window.c *** ../vim-8.1.0041/src/window.c 2018-06-06 18:02:31.402773772 +0200 --- src/window.c 2018-06-10 14:33:03.071395777 +0200 *************** *** 2107,2123 **** static void leaving_window(win_T *win) { // When leaving a prompt window stop Insert mode and perhaps restart // it when entering that window again. win->w_buffer->b_prompt_insert = restart_edit; restart_edit = NUL; // When leaving the window (or closing the window) was done from a ! // callback we need to break out of the Insert mode loop. if (State & INSERT) { stop_insert_mode = TRUE; ! if (bt_prompt(win->w_buffer) && win->w_buffer->b_prompt_insert == NUL) win->w_buffer->b_prompt_insert = 'A'; } } --- 2107,2128 ---- static void leaving_window(win_T *win) { + // Only matters for a prompt window. + if (!bt_prompt(win->w_buffer)) + return; + // When leaving a prompt window stop Insert mode and perhaps restart // it when entering that window again. win->w_buffer->b_prompt_insert = restart_edit; restart_edit = NUL; // When leaving the window (or closing the window) was done from a ! // callback we need to break out of the Insert mode loop and restart Insert ! // mode when entering the window again. if (State & INSERT) { stop_insert_mode = TRUE; ! if (win->w_buffer->b_prompt_insert == NUL) win->w_buffer->b_prompt_insert = 'A'; } } *************** *** 2125,2136 **** static void entering_window(win_T *win) { // When switching to a prompt buffer that was in Insert mode, don't stop // Insert mode, it may have been set in leaving_window(). ! if (bt_prompt(win->w_buffer) && win->w_buffer->b_prompt_insert != NUL) stop_insert_mode = FALSE; ! // When entering the prompt window may restart Insert mode. restart_edit = win->w_buffer->b_prompt_insert; } #endif --- 2130,2146 ---- static void entering_window(win_T *win) { + // Only matters for a prompt window. + if (!bt_prompt(win->w_buffer)) + return; + // When switching to a prompt buffer that was in Insert mode, don't stop // Insert mode, it may have been set in leaving_window(). ! if (win->w_buffer->b_prompt_insert != NUL) stop_insert_mode = FALSE; ! // When entering the prompt window restart Insert mode if we were in Insert ! // mode when we left it. restart_edit = win->w_buffer->b_prompt_insert; } #endif *** ../vim-8.1.0041/src/version.c 2018-06-10 13:55:48.527949068 +0200 --- src/version.c 2018-06-10 14:38:47.846545314 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 42, /**/ -- The only backup you need is the one that you didn't have time for. (Murphy) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///