terminal: Don't enter terminal mode from :normal

Ref: https://github.com/junegunn/fzf.vim/issues/8#issuecomment-139209765
This commit is contained in:
Thiago de Arruda
2015-09-10 09:22:59 -03:00
parent b7dab423ef
commit 1b1716477c
3 changed files with 24 additions and 2 deletions

View File

@@ -7624,6 +7624,10 @@ void update_topline_cursor(void)
*/
static void ex_normal(exarg_T *eap)
{
if (curbuf->terminal) {
EMSG("Can't re-enter normal mode from terminal mode");
return;
}
int save_msg_scroll = msg_scroll;
int save_restart_edit = restart_edit;
int save_msg_didout = msg_didout;
@@ -7715,7 +7719,14 @@ static void ex_normal(exarg_T *eap)
--ex_normal_busy;
msg_scroll = save_msg_scroll;
restart_edit = save_restart_edit;
if (force_restart_edit) {
force_restart_edit = false;
} else {
// some function called was aware of ex_normal and decided to override the
// value of restart_edit anyway. So far only used in terminal mode(see
// terminal_enter() in edit.c)
restart_edit = save_restart_edit;
}
p_im = save_insertmode;
finish_op = save_finish_op;
opcount = save_opcount;