Package: w3m Version: 0.5.3-11 Severity: wishlist Tags: upstream patch Forwarded a feature request from Laurence Richert <laurencerichert (at yahoo.de)> on September 19, 2013 at 6:53PM +0200: > I would like to ask if two functions could be implemented in an official > release. I use them pretty often in other programs such as vim and > vimperator and always get confused when switching to w3m. These would be: > - half page scrolling > - jumping to elements numbered by getLinkNumberStr() from Karsten > Schoelzel > I have attached two patch files containing these functions, based on > v0.5.3.
Thanks, -- Tatsuya Kinoshita
*** main.c.orig 2013-09-19 16:09:57.440750873 +0200
--- main.c 2013-09-19 18:01:52.108911310 +0200
***************
*** 1584,1593 ****
--- 1584,1605 ----
else
nscroll(-(prec_num ? searchKeyNum() : searchKeyNum()
* (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")
{
nscroll(searchKeyNum(), B_SCROLL);
}
***************
*** 3584,3593 ****
--- 3596,3632 ----
gotoLine(Currentbuf, po->line);
Currentbuf->pos = po->pos;
arrangeCursor(Currentbuf);
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")
{
*** proto.h.orig 2013-09-19 16:35:24.156787353 +0200 --- proto.h 2013-09-19 16:35:24.152787349 +0200 *************** *** 13,14 **** --- 13,16 ---- extern void pgBack(void); + extern void hpgFore(void); + extern void hpgBack(void); extern void lup1(void); *************** *** 63,64 **** --- 65,67 ---- extern void lastA(void); + extern void nthA(void); extern void onA(void);
pgphUcXhl05XA.pgp
Description: PGP signature

