Mercurial > vim
diff src/window.c @ 14037:afce2005fdc8 v8.1.0036
patch 8.1.0036: not restoring Insert mode if leaving prompt buffer with mouse
commit https://github.com/vim/vim/commit/891e1fd894720d0b99a9daefa41e8181844f819a
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 6 18:02:39 2018 +0200
patch 8.1.0036: not restoring Insert mode if leaving prompt buffer with mouse
Problem: Not restoring Insert mode if leaving a prompt buffer by using a
mouse click.
Solution: Set b_prompt_insert appropriately. Also correct cursor position
when moving cursor to last line.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 06 Jun 2018 18:15:05 +0200 |
parents | bccd66fa00c1 |
children | 3e6477e767ba |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -2115,12 +2115,21 @@ leaving_window(win_T *win) // 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'; + } } 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; }