mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 03:28:33 +00:00
:stopinsert should leave terminal-mode #9856
Problem: Calling :stopinsert from RPC while in terminal-mode does not go back to normal-mode. Solution: Implement a check() handler for state_enter(), adapted from insert_check(). Fix #7807
This commit is contained in:

committed by
Justin M. Keyes

parent
11bf89e3b5
commit
d928b036dc
@@ -403,6 +403,7 @@ void terminal_enter(void)
|
||||
redraw(false);
|
||||
|
||||
s->state.execute = terminal_execute;
|
||||
s->state.check = terminal_check;
|
||||
state_enter(&s->state);
|
||||
|
||||
restart_edit = 0;
|
||||
@@ -427,6 +428,19 @@ void terminal_enter(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Function executed before each iteration of terminal mode.
|
||||
// Return:
|
||||
// 1 if the iteration should continue normally
|
||||
// 0 if the main loop must exit
|
||||
static int terminal_check(VimState *state)
|
||||
{
|
||||
if (stop_insert_mode) {
|
||||
stop_insert_mode = false;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int terminal_execute(VimState *state, int key)
|
||||
{
|
||||
TerminalState *s = (TerminalState *)state;
|
||||
|
Reference in New Issue
Block a user