0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2018-06-06 18:02:39 +02:00
parent 6d41c78e35
commit 891e1fd894
4 changed files with 26 additions and 5 deletions

View File

@@ -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;
}