0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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.
This commit is contained in:
Bram Moolenaar 2019-02-22 17:56:43 +01:00
parent cd62512c55
commit 882d02eeb5
4 changed files with 25 additions and 10 deletions

View File

@ -81,6 +81,7 @@ Special in the terminal window: *CTRL-W_.* *CTRL-W_N*
evaluating an expression. evaluating an expression.
CTRL-W CTRL-C ends the job, see below |t_CTRL-W_CTRL-C| 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 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 See option 'termwinkey' for specifying another key instead of CTRL-W that
will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey' will work like CTRL-W. However, typing 'termwinkey' twice sends 'termwinkey'

View File

@ -1569,10 +1569,14 @@ func Test_terminal_termwinsize_mininmum()
endfunc endfunc
func Test_terminal_termwinkey() func Test_terminal_termwinkey()
call assert_equal(1, winnr('$')) " make three tabpages, terminal in the middle
let thiswin = win_getid() 0tabnew
tabnew
tabnext tabnext
tabnew
tabprev
call assert_equal(1, winnr('$'))
call assert_equal(2, tabpagenr())
let thiswin = win_getid()
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let termwin = bufwinid(buf) let termwin = bufwinid(buf)
@ -1582,11 +1586,16 @@ func Test_terminal_termwinkey()
call feedkeys("\<C-W>w", 'tx') call feedkeys("\<C-W>w", 'tx')
call assert_equal(termwin, win_getid()) call assert_equal(termwin, win_getid())
let tnr = tabpagenr()
call feedkeys("\<C-L>gt", "xt") 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 tabnext
call assert_equal(tnr, tabpagenr()) call assert_equal(2, tabpagenr())
call assert_equal(termwin, win_getid()) call assert_equal(termwin, win_getid())
let job = term_getjob(buf) let job = term_getjob(buf)
@ -1596,6 +1605,8 @@ func Test_terminal_termwinkey()
set termwinkey& set termwinkey&
tabnext tabnext
tabclose tabclose
tabprev
tabclose
endfunc endfunc
func Test_terminal_out_err() func Test_terminal_out_err()

View File

@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
974,
/**/ /**/
973, 973,
/**/ /**/

View File

@ -87,10 +87,7 @@ do_window(
#endif #endif
char_u cbuf[40]; char_u cbuf[40];
if (Prenum == 0) Prenum1 = Prenum == 0 ? 1 : Prenum;
Prenum1 = 1;
else
Prenum1 = Prenum;
#ifdef FEAT_CMDWIN #ifdef FEAT_CMDWIN
# define CHECK_CMDWIN \ # define CHECK_CMDWIN \
@ -588,6 +585,10 @@ wingotofile:
goto_tabpage((int)Prenum); goto_tabpage((int)Prenum);
break; break;
case 'T': // CTRL-W gT: go to previous tab page
goto_tabpage(-(int)Prenum1);
break;
default: default:
beep_flush(); beep_flush();
break; break;