]> granicus.if.org Git - vim/commitdiff
patch 8.1.0974: cannot switch from terminal window to previous tabpage v8.1.0974
authorBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 16:56:43 +0000 (17:56 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 22 Feb 2019 16:56:43 +0000 (17:56 +0100)
Problem:    Cannot switch from terminal window to previous tabpage.
Solution:   Make CTRL-W gT move to previous tabpage.

runtime/doc/terminal.txt
src/testdir/test_terminal.vim
src/version.c
src/window.c

index 0181d18def6f10aeffca3061311e699132f0e39b..297f37a6f142d91298d17da3f353c08ff3e8beff 100644 (file)
@@ -81,6 +81,7 @@ Special in the terminal window:                       *CTRL-W_.*  *CTRL-W_N*
                        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'
index ee50b570b29f32ee0da89588ed14ad98f9e7ff6d..e5a7be5a8e75b75f7bc0b8fac3d04ed86a17420d 100644 (file)
@@ -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("\<C-W>w", 'tx')
   call assert_equal(termwin, win_getid())
 
-  let tnr = tabpagenr()
   call feedkeys("\<C-L>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("\<C-L>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()
index cca92c8ee5db821e9a0af743396cbab82ae4836e..cd2554a979e06fe147c3e9041f8aca1b6661fe5f 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    974,
 /**/
     973,
 /**/
index 83e3e9f935b855a32d10b7b47711a2aabf5a3271..074c731ea8a3f63d11882d19cd1ec2a2831f46d7 100644 (file)
@@ -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;