diff src/ex_docmd.c @ 21727:860cad58f557 v8.2.1413

patch 8.2.1413: previous tab page not usable from an Ex command Commit: https://github.com/vim/vim/commit/94f4ffa7704921a3634e56b878e6dc362bc3d508 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 10 19:21:15 2020 +0200 patch 8.2.1413: previous tab page not usable from an Ex command Problem: Previous tab page not usable from an Ex command. Solution: Add the "#" argument for :tabnext et al. (Yegappan Lakshmanan, closes #6677)
author Bram Moolenaar <Bram@vim.org>
date Mon, 10 Aug 2020 19:30:04 +0200
parents 60ba361a7fdb
children 2f2e528c5782
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5412,6 +5412,15 @@ get_tabpage_arg(exarg_T *eap)
 	{
 	    if (STRCMP(p, "$") == 0)
 		tab_number = LAST_TAB_NR;
+	    else if (STRCMP(p, "#") == 0)
+		if (valid_tabpage(lastused_tabpage))
+		    tab_number = tabpage_index(lastused_tabpage);
+		else
+		{
+		    eap->errmsg = ex_errmsg(e_invargval, eap->arg);
+		    tab_number = 0;
+		    goto theend;
+		}
 	    else if (p == p_save || *p_save == '-' || *p != NUL
 		    || tab_number > LAST_TAB_NR)
 	    {