diff src/main.c @ 11866:be40c8a9240d v8.0.0813

patch 8.0.0813: cannot use a terminal window while the job is running commit https://github.com/vim/vim/commit/423802d1a282df35078539970eabf559186e1ec8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 30 16:52:24 2017 +0200 patch 8.0.0813: cannot use a terminal window while the job is running Problem: Cannot use Vim commands in a terminal window while the job is running. Solution: Implement Terminal Normal mode.
author Christian Brabandt <cb@256bit.org>
date Sun, 30 Jul 2017 17:00:04 +0200
parents 1ce1376fbbf8
children d036c1c8537d
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -1356,11 +1356,17 @@ main_loop(
 	else
 	{
 #ifdef FEAT_TERMINAL
-	    if (curbuf->b_term != NULL && oa.op_type == OP_NOP
-							  && oa.regname == NUL)
-		terminal_loop();
+	    if (term_use_loop() && oa.op_type == OP_NOP && oa.regname == NUL)
+	    {
+		/* If terminal_loop() returns OK we got a key that is handled
+		 * in Normal model.  With FAIL the terminal was closed and the
+		 * screen needs to be redrawn. */
+		if (terminal_loop() == OK)
+		    normal_cmd(&oa, TRUE);
+	    }
+	    else
 #endif
-	    normal_cmd(&oa, TRUE);
+		normal_cmd(&oa, TRUE);
 	}
     }
 }