Skip to content

Commit 2bb7b6b

Browse files
committed
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.
1 parent 304b64c commit 2bb7b6b

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/evalfunc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7849,6 +7849,10 @@ f_mode(typval_T *argvars, typval_T *rettv)
78497849
buf[0] = 'x';
78507850
buf[1] = '!';
78517851
}
7852+
#ifdef FEAT_TERMINAL
7853+
else if (term_use_loop())
7854+
buf[0] = 't';
7855+
#endif
78527856
else if (VIsual_active)
78537857
{
78547858
if (VIsual_select)

src/testdir/test_terminal.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ func Test_terminal_basic()
4242
call assert_match("^winpty://", job_info(g:job).tty)
4343
call assert_match("^winpty://", term_gettty(''))
4444
endif
45+
call assert_equal('t', mode())
46+
call assert_match('%aR[^\n]*running]', execute('ls'))
47+
4548
call Stop_shell_in_terminal(buf)
4649
call term_wait(buf)
50+
call assert_equal('n', mode())
51+
call assert_match('%aF[^\n]*finished]', execute('ls'))
4752

4853
" closing window wipes out the terminal buffer a with finished job
4954
close

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
936,
772774
/**/
773775
935,
774776
/**/

0 commit comments

Comments
 (0)