aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2013-10-12 10:59:25 +0000
committerTatsuya Kinoshita <tats@debian.org>2013-10-12 10:59:25 +0000
commit0b8986e8202b5793fd8cfd6e2a7ae53a6324d39a (patch)
tree7c2af3e5cfce761abbc0f595c3a03f4dc6143359
parentMerge branch 'bug/contact-list' (diff)
parentvim/-perator like handling (diff)
downloadw3m-0b8986e8202b5793fd8cfd6e2a7ae53a6324d39a.tar.gz
w3m-0b8986e8202b5793fd8cfd6e2a7ae53a6324d39a.zip
Merge branch 'feature/vim-like'
Diffstat (limited to '')
-rw-r--r--main.c39
-rw-r--r--proto.h3
2 files changed, 42 insertions, 0 deletions
diff --git a/main.c b/main.c
index 3012239..c49985d 100644
--- a/main.c
+++ b/main.c
@@ -1597,6 +1597,18 @@ DEFUN(pgBack, PREV_PAGE, "Move to previous page")
* (Currentbuf->LINES - 1)), prec_num ? B_SCROLL : B_NORMAL);
}
+/* Move half page forward */
+DEFUN(hpgFore, NEXT_HALF_PAGE, "Scroll down half page")
+{
+ nscroll(searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL);
+}
+
+/* Move half page backward */
+DEFUN(hpgBack, PREV_HALF_PAGE, "Scroll up half page")
+{
+ nscroll(-searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL);
+}
+
/* 1 line up */
DEFUN(lup1, UP, "Scroll up one line")
{
@@ -3602,6 +3614,33 @@ DEFUN(lastA, LINK_END, "Go to the last link")
displayBuffer(Currentbuf, B_NORMAL);
}
+/* go to the nth anchor */
+DEFUN(nthA, LINK_N, "Go to the nth link")
+{
+ HmarkerList *hl = Currentbuf->hmarklist;
+ BufferPoint *po;
+ Anchor *an;
+
+ int n = searchKeyNum();
+ if (n < 0 || n > hl->nmark) return;
+
+ if (Currentbuf->firstLine == NULL)
+ return;
+ if (!hl || hl->nmark == 0)
+ return;
+
+ po = hl->marks + n-1;
+ an = retrieveAnchor(Currentbuf->href, po->line, po->pos);
+ if (an == NULL)
+ an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos);
+ if (an == NULL) return;
+
+ gotoLine(Currentbuf, po->line);
+ Currentbuf->pos = po->pos;
+ arrangeCursor(Currentbuf);
+ displayBuffer(Currentbuf, B_NORMAL);
+}
+
/* go to the next anchor */
DEFUN(nextA, NEXT_LINK, "Move to next link")
{
diff --git a/proto.h b/proto.h
index c3aa046..7248ee5 100644
--- a/proto.h
+++ b/proto.h
@@ -11,6 +11,8 @@ extern void pushEvent(int cmd, void *data);
extern MySignalHandler intTrap(SIGNAL_ARG);
extern void pgFore(void);
extern void pgBack(void);
+extern void hpgFore(void);
+extern void hpgBack(void);
extern void lup1(void);
extern void ldown1(void);
extern void ctrCsrV(void);
@@ -61,6 +63,7 @@ extern void submitForm(void);
extern void followForm(void);
extern void topA(void);
extern void lastA(void);
+extern void nthA(void);
extern void onA(void);
extern void nextA(void);