diff options
author | Michal Mazurek <akfaew@jasminek.net> | 2011-08-02 19:42:59 +0000 |
---|---|---|
committer | Michal Mazurek <akfaew@jasminek.net> | 2011-08-02 19:42:59 +0000 |
commit | db53357fcf53d56e7857fe3152a249dd9ab36f7e (patch) | |
tree | efcef1f4904221a578a3db677979fabfeb6013dc | |
parent | bf46e538022db645e7c6d6a0e502e7add9872a15 (diff) | |
download | xombrero-db53357fcf53d56e7857fe3152a249dd9ab36f7e.tar.gz |
Add the 'move percent' buffer command. This is diff bcmd #4.
ok marco
-rw-r--r-- | xxxterm.1 | 3 | ||||
-rw-r--r-- | xxxterm.c | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/xxxterm.1 b/xxxterm.1 index aa7da40..176bb77 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -560,6 +560,9 @@ as the beginning of a buffer command. This is the case with go to the top of the page .It Cm gG go to the bottom of the page +.It Cm [0-9]+% +go to the +.Cm arg percent of the page .It Cm gh open the home page in the current tab diff --git a/xxxterm.c b/xxxterm.c index 88121ac..3e70df9 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -402,6 +402,7 @@ struct karg { #define XT_MOVE_FARLEFT (10) #define XT_MOVE_RIGHT (11) #define XT_MOVE_FARRIGHT (12) +#define XT_MOVE_PERCENT (13) #define XT_TAB_LAST (-4) #define XT_TAB_FIRST (-3) @@ -3726,6 +3727,7 @@ move(struct tab *t, struct karg *args) case XT_MOVE_PAGEUP: case XT_MOVE_HALFDOWN: case XT_MOVE_HALFUP: + case XT_MOVE_PERCENT: adjust = t->adjust_v; break; default: @@ -3781,6 +3783,18 @@ move(struct tab *t, struct karg *args) pos -= pi / 2; gtk_adjustment_set_value(adjust, MAX(pos, lower)); break; + case XT_MOVE_PERCENT: + { + double percent; + + percent = atoi(args->s) / 100.0; + pos = max * percent; + if (pos < 0.0 || pos > max) + break; + + gtk_adjustment_set_value(adjust, pos); + break; + } default: return (XT_CB_PASSTHROUGH); } @@ -6612,6 +6626,7 @@ struct buffercmd { } buffercmds[] = { { "^gg$", move, XT_MOVE_TOP }, { "^gG$", move, XT_MOVE_BOTTOM }, + { "^[0-9]+%$", move, XT_MOVE_PERCENT }, { "^gh$", go_home, 0 }, { "^[0-9]+t$", gototab, 0 }, { "^ZR$", restart, 0 }, |