vim-patch:8.1.0064: typing CTRL-W in a prompt buffer shows mode "-- --"

Problem:    Typing CTRL-W in a prompt buffer shows mode "-- --".
Solution:   Set restart_edit to 'A' and check for it.
942b4541a2

Nvim already checked for 'i' in showmode(), so this bug was fixed with <C-W>
(though this patch now changes <C-W> to use 'A').

However, the missing changes I ported for v8.1.0036 use 'A' when a callback
leaves the window in insert mode and edit gets restarted, so this bug was
possible there.

Modify showmode() restart_edit condition to match v8.2.1978:
957cf67d50
This commit is contained in:
Sean Dewar 2021-11-07 20:57:09 +00:00
parent b9ab4c1dea
commit 1fffccc5d6
No known key found for this signature in database
GPG Key ID: 08CC2C83AD41B581
3 changed files with 6 additions and 3 deletions

View File

@ -995,7 +995,7 @@ static int insert_handle_key(InsertState *s)
// In a prompt window CTRL-W is used for window commands. // In a prompt window CTRL-W is used for window commands.
// Use Shift-CTRL-W to delete a word. // Use Shift-CTRL-W to delete a word.
stuffcharReadbuff(Ctrl_W); stuffcharReadbuff(Ctrl_W);
restart_edit = 'i'; restart_edit = 'A';
s->nomove = true; s->nomove = true;
s->count = 0; s->count = 0;
return 0; return 0;

View File

@ -6930,7 +6930,7 @@ int showmode(void)
do_mode = ((p_smd && msg_silent == 0) do_mode = ((p_smd && msg_silent == 0)
&& ((State & TERM_FOCUS) && ((State & TERM_FOCUS)
|| (State & INSERT) || (State & INSERT)
|| restart_edit || restart_edit != NUL
|| VIsual_active)); || VIsual_active));
if (do_mode || reg_recording != 0) { if (do_mode || reg_recording != 0) {
// Don't show mode right now, when not redrawing or inside a mapping. // Don't show mode right now, when not redrawing or inside a mapping.
@ -7010,7 +7010,7 @@ int showmode(void)
} }
msg_puts_attr(_(" INSERT"), attr); msg_puts_attr(_(" INSERT"), attr);
} else if (restart_edit == 'I' || restart_edit == 'i' } else if (restart_edit == 'I' || restart_edit == 'i'
|| restart_edit == 'a') { || restart_edit == 'a' || restart_edit == 'A') {
msg_puts_attr(_(" (insert)"), attr); msg_puts_attr(_(" (insert)"), attr);
} else if (restart_edit == 'R') { } else if (restart_edit == 'R') {
msg_puts_attr(_(" (replace)"), attr); msg_puts_attr(_(" (replace)"), attr);

View File

@ -2240,6 +2240,9 @@ static void leaving_window(win_T *const win)
// When leaving a prompt window stop Insert mode and perhaps restart // When leaving a prompt window stop Insert mode and perhaps restart
// it when entering that window again. // it when entering that window again.
win->w_buffer->b_prompt_insert = restart_edit; win->w_buffer->b_prompt_insert = restart_edit;
if (restart_edit != NUL && mode_displayed) {
clear_cmdline = true; // unshow mode later
}
restart_edit = NUL; restart_edit = NUL;
// When leaving the window (or closing the window) was done from a // When leaving the window (or closing the window) was done from a