Skip to content

Commit 72e83c1

Browse files
committed
patch 8.1.0972: cannot switch from terminal window to next tabpage
Problem: Cannot switch from terminal window to next tabpage. Solution: Make CTRL-W gt move to next tabpage.
1 parent f6b4010 commit 72e83c1

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

runtime/doc/terminal.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*terminal.txt* For Vim version 8.1. Last change: 2019 Feb 16
1+
*terminal.txt* For Vim version 8.1. Last change: 2019 Feb 22
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -80,6 +80,7 @@ Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
8080
Also works with the = register to insert the result of
8181
evaluating an expression.
8282
CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C|
83+
CTRL-W gt go to next tabpage, same as `gt`
8384

8485
See option 'termwinkey' for specifying another key instead of CTRL-W that
8586
will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey'

src/testdir/test_terminal.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,19 +1571,31 @@ endfunc
15711571
func Test_terminal_termwinkey()
15721572
call assert_equal(1, winnr('$'))
15731573
let thiswin = win_getid()
1574+
tabnew
1575+
tabnext
15741576

15751577
let buf = Run_shell_in_terminal({})
15761578
let termwin = bufwinid(buf)
15771579
set termwinkey=<C-L>
15781580
call feedkeys("\<C-L>w", 'tx')
15791581
call assert_equal(thiswin, win_getid())
15801582
call feedkeys("\<C-W>w", 'tx')
1583+
call assert_equal(termwin, win_getid())
1584+
1585+
let tnr = tabpagenr()
1586+
call feedkeys("\<C-L>gt", "xt")
1587+
call assert_notequal(tnr, tabpagenr())
1588+
tabnext
1589+
call assert_equal(tnr, tabpagenr())
1590+
call assert_equal(termwin, win_getid())
15811591

15821592
let job = term_getjob(buf)
15831593
call feedkeys("\<C-L>\<C-C>", 'tx')
15841594
call WaitForAssert({-> assert_equal("dead", job_status(job))})
15851595

15861596
set termwinkey&
1597+
tabnext
1598+
tabclose
15871599
endfunc
15881600

15891601
func Test_terminal_out_err()

src/version.c

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

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
972,
782784
/**/
783785
971,
784786
/**/

src/window.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static win_T *win_alloc(win_T *after, int hidden);
6767
static char *m_onlyone = N_("Already only one window");
6868

6969
/*
70-
* all CTRL-W window commands are handled here, called from normal_cmd().
70+
* All CTRL-W window commands are handled here, called from normal_cmd().
7171
*/
7272
void
7373
do_window(
@@ -584,6 +584,10 @@ do_window(
584584
nchar = xchar;
585585
goto wingotofile;
586586
#endif
587+
case 't': // CTRL-W gt: go to next tab page
588+
goto_tabpage((int)Prenum);
589+
break;
590+
587591
default:
588592
beep_flush();
589593
break;

0 commit comments

Comments
 (0)