]> granicus.if.org Git - vim/commitdiff
patch 8.0.1113: can go to Insert mode from Terminal-Normal mode v8.0.1113
authorBram Moolenaar <Bram@vim.org>
Sat, 16 Sep 2017 13:38:04 +0000 (15:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 Sep 2017 13:38:04 +0000 (15:38 +0200)
Problem:    Can go to Insert mode from Terminal-Normal mode.
Solution:   Prevent :startinsert and "VA" to enter Insert mode. (Yasuhiro
            Matsumoto, closes #2092)

src/normal.c
src/version.c

index a1b2612f7701f40488288733a599114154929b77..cbdfbc43974473d5dbc7c9705c7d3f6994c48ea0 100644 (file)
@@ -1309,8 +1309,8 @@ normal_end:
 #endif
 
 #ifdef FEAT_TERMINAL
-    /* don't go to Insert mode from Terminal-Job mode */
-    if (term_use_loop())
+    /* don't go to Insert mode if a terminal has a running job */
+    if (term_job_running(curbuf->b_term))
        restart_edit = 0;
 #endif
 
@@ -9044,7 +9044,18 @@ nv_edit(cmdarg_T *cap)
 
     /* in Visual mode "A" and "I" are an operator */
     if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I'))
+    {
+#ifdef FEAT_TERMINAL
+       if (term_in_normal_mode())
+       {
+           end_visual_mode();
+           clearop(cap->oap);
+           term_enter_job_mode();
+           return;
+       }
+#endif
        v_visop(cap);
+    }
 
     /* in Visual mode and after an operator "a" and "i" are for text objects */
     else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i')
index ce9d2c2499b31143acc7f6ac759d99d41c2d4398..6ea93a0dcb1dfbc5b10f1804cf8e6a9910b7a4e6 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1113,
 /**/
     1112,
 /**/