# HG changeset patch # User Bram Moolenaar # Date 1550854805 -3600 # Node ID c38fb03a6055ee35f221bd71c1e8604c1dcb23e0 # Parent 8efaa4a54d494e6affb66cc41450916175c667b9 patch 8.1.0974: cannot switch from terminal window to previous tabpage commit https://github.com/vim/vim/commit/882d02eeb571a13a502fe82a04c9eaffa630c294 Author: Bram Moolenaar Date: Fri Feb 22 17:56:43 2019 +0100 patch 8.1.0974: cannot switch from terminal window to previous tabpage Problem: Cannot switch from terminal window to previous tabpage. Solution: Make CTRL-W gT move to previous tabpage. diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -81,6 +81,7 @@ Special in the terminal window: *CTRL- evaluating an expression. CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| CTRL-W gt go to next tabpage, same as `gt` + CTRL-W gT go to previous tabpage, same as `gT` See option 'termwinkey' for specifying another key instead of CTRL-W that will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey' diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1569,10 +1569,14 @@ func Test_terminal_termwinsize_mininmum( endfunc func Test_terminal_termwinkey() + " make three tabpages, terminal in the middle + 0tabnew + tabnext + tabnew + tabprev call assert_equal(1, winnr('$')) + call assert_equal(2, tabpagenr()) let thiswin = win_getid() - tabnew - tabnext let buf = Run_shell_in_terminal({}) let termwin = bufwinid(buf) @@ -1582,11 +1586,16 @@ func Test_terminal_termwinkey() call feedkeys("\w", 'tx') call assert_equal(termwin, win_getid()) - let tnr = tabpagenr() call feedkeys("\gt", "xt") - call assert_notequal(tnr, tabpagenr()) + call assert_equal(3, tabpagenr()) + tabprev + call assert_equal(2, tabpagenr()) + call assert_equal(termwin, win_getid()) + + call feedkeys("\gT", "xt") + call assert_equal(1, tabpagenr()) tabnext - call assert_equal(tnr, tabpagenr()) + call assert_equal(2, tabpagenr()) call assert_equal(termwin, win_getid()) let job = term_getjob(buf) @@ -1596,6 +1605,8 @@ func Test_terminal_termwinkey() set termwinkey& tabnext tabclose + tabprev + tabclose endfunc func Test_terminal_out_err() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -780,6 +780,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 974, +/**/ 973, /**/ 972, diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -87,10 +87,7 @@ do_window( #endif char_u cbuf[40]; - if (Prenum == 0) - Prenum1 = 1; - else - Prenum1 = Prenum; + Prenum1 = Prenum == 0 ? 1 : Prenum; #ifdef FEAT_CMDWIN # define CHECK_CMDWIN \ @@ -588,6 +585,10 @@ wingotofile: goto_tabpage((int)Prenum); break; + case 'T': // CTRL-W gT: go to previous tab page + goto_tabpage(-(int)Prenum1); + break; + default: beep_flush(); break;