about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--xxxterm.112
-rw-r--r--xxxterm.c56
2 files changed, 67 insertions, 1 deletions
diff --git a/xxxterm.1 b/xxxterm.1
index 9133be0..afab5c3 100644
--- a/xxxterm.1
+++ b/xxxterm.1
@@ -708,6 +708,18 @@ open the uri marked as quickmark
 in a new tab
 .It Cm [0-9]+t
 activate tab number
+.It Cm g0
+go to first tab
+.It Cm g$
+go to last tab
+.It Cm [0-9]*gt
+go to the
+.Cm arg
+next tab
+.It Cm [0-9]*gT
+go to the
+.Cm arg
+previous tab
 .Cm arg
 .It Cm ZZ
 quit
diff --git a/xxxterm.c b/xxxterm.c
index 2efff3d..8a5f513 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -4811,7 +4811,11 @@ gototab(struct tab *t, struct karg *args)
 
 	tab = atoi(args->s);
 
-	arg.i = XT_TAB_NEXT;
+	if (args->i == 0)
+		arg.i = XT_TAB_NEXT;
+	else
+		arg.i = args->i;
+
 	arg.precount = tab;
 
 	movetab(t, &arg);
@@ -4820,6 +4824,52 @@ gototab(struct tab *t, struct karg *args)
 }
 
 int
+gotonexttab(struct tab *t, struct karg *args)
+{
+	int			count, n_tabs, dest;
+	struct karg 		arg = {0, NULL, -1};
+
+	count = atoi(args->s);
+	if (count == 0)
+		count = 1;
+
+	arg.i = XT_TAB_NEXT;
+
+	n_tabs = gtk_notebook_get_n_pages(notebook);
+	dest = gtk_notebook_get_current_page(notebook);
+
+	dest += (count + 1) % n_tabs;
+	if (dest > n_tabs)
+		dest -= n_tabs;
+	arg.precount = dest;
+
+	DNPRINTF(XT_D_BUFFERCMD, "gotonexttab: count: %d - dest : %d \n", count, dest);
+
+	movetab(t, &arg);
+
+	return (0);
+}
+
+int
+gotoprevtab(struct tab *t, struct karg *args)
+{
+	int		count;
+	struct 		karg arg = {0, NULL, -1};
+
+	count = atoi(args->s);
+	if (count == 0)
+		count = 1;
+
+	arg.i = XT_TAB_PREV;
+	arg.precount = count;
+
+	DNPRINTF(XT_D_BUFFERCMD, "gotoprevtab: count: %d\n", count);
+	movetab(t, &arg);
+
+	return (0);
+}
+
+int
 zoom_amount(struct tab *t, struct karg *arg)
 {
 	struct karg	narg = {0, NULL, -1};
@@ -4874,6 +4924,10 @@ struct buffercmd {
 	{ "^m[a-zA-Z0-9]$",	XT_PRE_NO,	"m",	mark,		XT_MARK_SET },
 	{ "^['][a-zA-Z0-9]$",	XT_PRE_NO,	"'",	mark,		XT_MARK_GOTO },
 	{ "^[0-9]+t$",		XT_PRE_YES,	"t",	gototab,	0 },
+	{ "^g0$",		XT_PRE_YES,	"g0",	gototab,	XT_TAB_FIRST },
+	{ "^g[$]$",		XT_PRE_YES,	"g$",	gototab,	XT_TAB_LAST },
+	{ "^[0-9]*gt$",		XT_PRE_YES,	"t",	gotonexttab,	0 },
+	{ "^[0-9]*gT$",		XT_PRE_YES,	"T",	gotoprevtab,	0 },
 	{ "^M[a-zA-Z0-9]$",	XT_PRE_NO,	"M",	qmark,		XT_QMARK_SET },
 	{ "^go[a-zA-Z0-9]$",	XT_PRE_NO,	"go",	qmark,		XT_QMARK_OPEN },
 	{ "^gn[a-zA-Z0-9]$",	XT_PRE_NO,	"gn",	qmark,		XT_QMARK_TAB },
193'>193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220