about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authormarco <marco@conformal.com>2011-11-03 17:19:58 -0500
committermarco <marco@conformal.com>2011-11-03 17:19:58 -0500
commit3dd74cf1056c29641d0666ec7c0fbe4b88873775 (patch)
tree63fe9a2d61f2df7d7fc1f37821e4aa3f4ccc644a
parentfd70f51b84dccb2dc2d34cc62a9ac2da164f2515 (diff)
downloadxombrero-3dd74cf1056c29641d0666ec7c0fbe4b88873775.tar.gz
add zz command to center page
-rw-r--r--xxxterm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 8658086..e227212 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -131,6 +131,7 @@ TAILQ_HEAD(command_list, command_entry);
 #define XT_MOVE_RIGHT		(11)
 #define XT_MOVE_FARRIGHT	(12)
 #define XT_MOVE_PERCENT		(13)
+#define XT_MOVE_CENTER		(14)
 
 #define XT_QMARK_SET		(0)
 #define XT_QMARK_OPEN		(1)
@@ -2102,6 +2103,7 @@ move(struct tab *t, struct karg *args)
 	case XT_MOVE_HALFDOWN:
 	case XT_MOVE_HALFUP:
 	case XT_MOVE_PERCENT:
+	case XT_MOVE_CENTER:
 		adjust = t->adjust_v;
 		break;
 	default:
@@ -2157,6 +2159,9 @@ move(struct tab *t, struct karg *args)
 		pos -= pi / 2;
 		gtk_adjustment_set_value(adjust, MAX(pos, lower));
 		break;
+	case XT_MOVE_CENTER:
+		args->s = g_strdup("50.0");
+		/* FALLTHROUGH */
 	case XT_MOVE_PERCENT:
 		percent = atoi(args->s) / 100.0;
 		pos = max * percent;
@@ -4448,6 +4453,7 @@ struct buffercmd {
 	{ "^gg$",		XT_PRE_NO,	"gg",	move,		XT_MOVE_TOP },
 	{ "^gG$",		XT_PRE_NO,	"gG",	move,		XT_MOVE_BOTTOM },
 	{ "^[0-9]+%$",		XT_PRE_YES,	"%",	move,		XT_MOVE_PERCENT },
+	{ "^zz$",		XT_PRE_NO,	"zz",	move,		XT_MOVE_CENTER },
 	{ "^gh$",		XT_PRE_NO,	"gh",	go_home,	0 },
 	{ "^m[a-zA-Z0-9]$",	XT_PRE_NO,	"m",	mark,		XT_MARK_SET },
 	{ "^['][a-zA-Z0-9]$",	XT_PRE_NO,	"'",	mark,		XT_MARK_GOTO },