From c5f190e0c21b4e8465502fd9f260c3d49a4102ab Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 14 Mar 2022 11:37:44 +0000 Subject: vim-patch:8.2.1401: cannot jump to the last used tabpage Problem: Cannot jump to the last used tabpage. Solution: Add g and tabpagnr('#'). (Yegappan Lakshmanan, closes vim/vim#6661, neovim #11626) https://github.com/vim/vim/commit/62a232506d06f6d1b3b7271801c907d6294dfe84 Nvim implemented this feature before Vim, but Vim made some useful changes (e.g: beeping on failure). Port the changes to closer match Vim (also makes porting future patches easier). Also note that because CHECK_CMDWIN was added to goto_tabpage_tp, there is no need to do the extra work with tabpage_index and goto_tabpage inside goto_tabpage_lastused to fix cmdwin issues any more (#11692). Note that while goto_tabpage_tp doesn't check for textlock like goto_tabpage does, it shouldn't matter as it is already checked for earlier. Add tags for to tabpage.txt, and refer to over CTRL-Tab to be consistent with other docs like the patch. Remove mention of "previous tabpage" (it can be confused with the tabpage to the left, e.g: `:tabprevious`). Similarly, don't rename old_curtab to last_tab in enter_tabpage (it might be confused with the right-most tabpage, e.g: `:tablast`). Cherry-pick Test_tabpage change from v8.2.0634. https://github.com/vim/vim/commit/92b83ccfda7a1d654ccaaf161a9c8a8e01fbcf76 --- src/nvim/eval/funcs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/nvim/eval') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index b249dffe11..b74f9759ac 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -11213,9 +11213,7 @@ static void f_tabpagenr(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (strcmp(arg, "$") == 0) { nr = tabpage_index(NULL) - 1; } else if (strcmp(arg, "#") == 0) { - nr = valid_tabpage(lastused_tabpage) - ? tabpage_index(lastused_tabpage) - : nr; + nr = valid_tabpage(lastused_tabpage) ? tabpage_index(lastused_tabpage) : 0; } else { semsg(_(e_invexpr2), arg); } -- cgit