]> granicus.if.org Git - vim/commitdiff
patch 8.0.0936: mode() returns wrong value for a terminal window v8.0.0936
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Aug 2017 18:58:33 +0000 (20:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Aug 2017 18:58:33 +0000 (20:58 +0200)
Problem:    Mode() returns wrong value for a terminal window.
Solution:   Return 't' when typed keys go to a job.

src/evalfunc.c
src/testdir/test_terminal.vim
src/version.c

index 3d657f73e638b82449ab037efc113f2a01c7cc07..2be7fe1bf2e6b6feb3f0f8a8761847ea138a5aa5 100644 (file)
@@ -7849,6 +7849,10 @@ f_mode(typval_T *argvars, typval_T *rettv)
        buf[0] = 'x';
        buf[1] = '!';
     }
+#ifdef FEAT_TERMINAL
+    else if (term_use_loop())
+       buf[0] = 't';
+#endif
     else if (VIsual_active)
     {
        if (VIsual_select)
index 605292e6a5efda9388f6db3b8f0f283dfc8c8f70..e18087bbdb7ea88f27126a7bd3b8ea68816d9bbc 100644 (file)
@@ -42,8 +42,13 @@ func Test_terminal_basic()
     call assert_match("^winpty://", job_info(g:job).tty)
     call assert_match("^winpty://", term_gettty(''))
   endif
+  call assert_equal('t', mode())
+  call assert_match('%aR[^\n]*running]', execute('ls'))
+
   call Stop_shell_in_terminal(buf)
   call term_wait(buf)
+  call assert_equal('n', mode())
+  call assert_match('%aF[^\n]*finished]', execute('ls'))
 
   " closing window wipes out the terminal buffer a with finished job
   close
index 61ee3c06e0efd047ebf704b652a1f03625a32f3f..ccf857caf4eca39d8e04f2c253cfc3f25676a475 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    936,
 /**/
     935,
 /**/