From: Bram Moolenaar Date: Sun, 13 Aug 2017 18:58:33 +0000 (+0200) Subject: patch 8.0.0936: mode() returns wrong value for a terminal window X-Git-Tag: v8.0.0936 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bb7b6b0e477612cc098cba27cc63ec3d19a2527;p=vim patch 8.0.0936: mode() returns wrong value for a terminal window Problem: Mode() returns wrong value for a terminal window. Solution: Return 't' when typed keys go to a job. --- diff --git a/src/evalfunc.c b/src/evalfunc.c index 3d657f73e..2be7fe1bf 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 605292e6a..e18087bbd 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -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 diff --git a/src/version.c b/src/version.c index 61ee3c06e..ccf857caf 100644 --- a/src/version.c +++ b/src/version.c @@ -769,6 +769,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 936, /**/ 935, /**/