updated for version 7.3.591
Problem: Can only move to a tab by absolute number.
Solution: Move a number of tabs to the left or the right. (Lech Lorens)
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index ac61f1a..cfe1502 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -944,7 +944,7 @@
EX(CMD_tabfirst, "tabfirst", ex_tabnext,
TRLBAR),
EX(CMD_tabmove, "tabmove", ex_tabmove,
- RANGE|NOTADR|ZEROR|COUNT|TRLBAR|ZEROR),
+ RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR),
EX(CMD_tablast, "tablast", ex_tabnext,
TRLBAR),
EX(CMD_tabnext, "tabnext", ex_tabnext,
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6740a51..cc80c14 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7478,7 +7478,42 @@
ex_tabmove(eap)
exarg_T *eap;
{
- tabpage_move(eap->addr_count == 0 ? 9999 : (int)eap->line2);
+ int tab_number = 9999;
+
+ if (eap->arg && *eap->arg != NUL)
+ {
+ char_u *p = eap->arg;
+ int relative = 0; /* argument +N/-N means: move N places to the
+ * right/left relative to the current position. */
+
+ if (*eap->arg == '-')
+ {
+ relative = -1;
+ p = eap->arg + 1;
+ }
+ else if (*eap->arg == '+')
+ {
+ relative = 1;
+ p = eap->arg + 1;
+ }
+ else
+ p = eap->arg;
+
+ if (p == skipdigits(p))
+ {
+ /* No numbers as argument. */
+ eap->errmsg = e_invarg;
+ return;
+ }
+
+ tab_number = getdigits(&p);
+ if (relative != 0)
+ tab_number = tab_number * relative + tabpage_index(curtab) - 1;;
+ }
+ else if (eap->addr_count != 0)
+ tab_number = eap->line2;
+
+ tabpage_move(tab_number);
}
/*
diff --git a/src/testdir/test62.in b/src/testdir/test62.in
index 1e514cd..fd1844b 100644
--- a/src/testdir/test62.in
+++ b/src/testdir/test62.in
Binary files differ
diff --git a/src/testdir/test62.ok b/src/testdir/test62.ok
index 7625cd2..0ac1fcb 100644
--- a/src/testdir/test62.ok
+++ b/src/testdir/test62.ok
@@ -8,3 +8,13 @@
tab drop 1: pass
tab drop 2: pass
tab drop 3: pass
+1
+6
+4
+8
+10
+1
+10
+4
+6
+E474 caught.
diff --git a/src/version.c b/src/version.c
index 637abb7..4bfec78 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 591,
+/**/
590,
/**/
589,
diff --git a/src/window.c b/src/window.c
index c65f49d..6460684 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3929,7 +3929,7 @@
}
/* Re-insert it at the specified position. */
- if (n == 0)
+ if (n <= 0)
{
curtab->tp_next = first_tabpage;
first_tabpage = curtab;