diff options
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | file.c | 23 | ||||
-rw-r--r-- | fm.h | 3 | ||||
-rw-r--r-- | main.c | 21 | ||||
-rw-r--r-- | proto.h | 4 | ||||
-rw-r--r-- | rc.c | 5 | ||||
-rw-r--r-- | table.c | 8 |
7 files changed, 67 insertions, 10 deletions
@@ -1,6 +1,17 @@ 2010-07-19 d+w3m@vdr.jp * [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org + * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=329862#20 + * table.c (feed_table_tag): check displayLinkNumber. + * proto.h: add getLinkNumberStr(). + * main.c (do_dump): check displayLinkNumber. + * fm.h: add global variable displayLinkNumber. + * file.c (getLinkNumberStr): added. + (process_input, process_select, HTMLtagproc1): check displayLinkNumber. + +2010-07-19 d+w3m@vdr.jp + + * [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=329863#8 * rc.c: Introduce option pseudo_inlines. * fm.h: add global variable pseudoInlines. @@ -9019,4 +9030,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.1014 2010/07/19 12:53:39 htrb Exp $ +$Id: ChangeLog,v 1.1015 2010/07/19 23:33:59 htrb Exp $ @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.258 2010/07/19 12:53:39 htrb Exp $ */ +/* $Id: file.c,v 1.259 2010/07/19 23:34:00 htrb Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -1686,6 +1686,12 @@ checkRedirection(ParsedURL *pu) return TRUE; } +Str +getLinkNumberStr(int correction) +{ + return Sprintf("[%d]", cur_hseq + correction); +} + /* * loadGeneralFile: load file to buffer */ @@ -3610,9 +3616,13 @@ process_input(struct parsed_tag *tag) case FORM_INPUT_TEXT: case FORM_INPUT_FILE: case FORM_INPUT_CHECKBOX: + if (displayLinkNumber) + Strcat(tmp, getLinkNumberStr(0)); Strcat_char(tmp, '['); break; case FORM_INPUT_RADIO: + if (displayLinkNumber) + Strcat(tmp, getLinkNumberStr(0)); Strcat_char(tmp, '('); } Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s " @@ -3653,6 +3663,8 @@ process_input(struct parsed_tag *tag) case FORM_INPUT_SUBMIT: case FORM_INPUT_BUTTON: case FORM_INPUT_RESET: + if (displayLinkNumber) + Strcat(tmp, getLinkNumberStr(-1)); Strcat_charp(tmp, "["); break; } @@ -3739,9 +3751,12 @@ process_select(struct parsed_tag *tag) #ifdef MENU_SELECT if (!select_is_multiple) { - select_str = Sprintf("<pre_int>[<input_alt hseq=\"%d\" " + select_str = Strnew_charp("<pre_int>"); + if (displayLinkNumber) + Strcat(select_str, getLinkNumberStr(0)); + Strcat(select_str, Sprintf("[<input_alt hseq=\"%d\" " "fid=\"%d\" type=select name=\"%s\" selectnumber=%d", - cur_hseq++, cur_form_id, html_quote(p), n_select); + cur_hseq++, cur_form_id, html_quote(p), n_select)); Strcat_charp(select_str, ">"); if (n_select == max_select) { max_select *= 2; @@ -4789,6 +4804,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) obuf->anchor.hseq = cur_hseq; tmp = process_anchor(tag, h_env->tagbuf->ptr); push_tag(obuf, tmp->ptr, HTML_A); + if (displayLinkNumber) + HTMLlineproc1(getLinkNumberStr(-1)->ptr, h_env); return 1; } return 0; @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.142 2010/07/19 12:53:39 htrb Exp $ */ +/* $Id: fm.h,v 1.143 2010/07/19 23:34:01 htrb Exp $ */ /* * w3m: WWW wo Miru utility * @@ -932,6 +932,7 @@ global int label_topline init(FALSE); global int nextpage_topline init(FALSE); global char *displayTitleTerm init(NULL); global int displayLink init(FALSE); +global int displayLinkNumber init(FALSE); global int displayLineInfo init(FALSE); global int DecodeURL init(FALSE); global int retryAsHttp init(TRUE); @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.262 2010/07/19 12:08:41 htrb Exp $ */ +/* $Id: main.c,v 1.263 2010/07/19 23:34:01 htrb Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -1282,8 +1282,25 @@ do_dump(Buffer *buf) dump_head(buf); if (w3m_dump & DUMP_SOURCE) dump_source(buf); - if (w3m_dump == DUMP_BUFFER) + if (w3m_dump == DUMP_BUFFER) { + int i; saveBuffer(buf, stdout, FALSE); + if (displayLinkNumber && buf->href) { + printf("\nReferences:\n\n"); + for (i = 0; i < buf->href->nanchor; i++) { + ParsedURL pu; + static Str s = NULL; + if (buf->href->anchors[i].slave) + continue; + parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf)); + s = parsedURL2Str(&pu); + if (DecodeURL) + s = Strnew_charp(url_unquote_conv + (s->ptr, Currentbuf->document_charset)); + printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, s->ptr); + } + } + } mySignal(SIGINT, prevtrap); } @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.102 2010/07/18 14:10:09 htrb Exp $ */ +/* $Id: proto.h,v 1.103 2010/07/19 23:34:01 htrb Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -775,6 +775,8 @@ extern void wrapToggle(void); extern void saveBufferInfo(void); #endif +extern Str getLinkNumberStr(int correction); + extern void dispVer(void); #ifdef USE_INCLUDED_SRAND48 @@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.111 2010/07/19 12:53:39 htrb Exp $ */ +/* $Id: rc.c,v 1.112 2010/07/19 23:34:01 htrb Exp $ */ /* * Initialization file etc. */ @@ -72,6 +72,7 @@ static int OptionEncode = FALSE; #define CMT_OPEN_TAB_BLANK N_("Open link on new tab if target is _blank or _new") #define CMT_OPEN_TAB_DL_LIST N_("Open download list panel on new tab") #define CMT_DISPLINK N_("Display link URL automatically") +#define CMT_DISPLINKNUMBER N_("Display link numbers") #define CMT_DECODE_URL N_("Display decoded URL") #define CMT_DISPLINEINFO N_("Display current line number") #define CMT_DISP_IMAGE N_("Display inline images") @@ -357,6 +358,8 @@ struct param_ptr params1[] = { CMT_OPEN_TAB_DL_LIST, NULL}, {"display_link", P_INT, PI_ONOFF, (void *)&displayLink, CMT_DISPLINK, NULL}, + {"display_link_number", P_INT, PI_ONOFF, (void *)&displayLinkNumber, + CMT_DISPLINKNUMBER, NULL}, {"decode_url", P_INT, PI_ONOFF, (void *)&DecodeURL, CMT_DECODE_URL, NULL}, {"display_lineinfo", P_INT, PI_ONOFF, (void *)&displayLineInfo, CMT_DISPLINEINFO, NULL}, @@ -1,4 +1,4 @@ -/* $Id: table.c,v 1.55 2007/05/23 13:07:44 inu Exp $ */ +/* $Id: table.c,v 1.56 2010/07/19 23:34:01 htrb Exp $ */ /* * HTML table */ @@ -2912,6 +2912,12 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, check_rowcol(tbl, mode); if (i == 0) { Str tmp = process_anchor(tag, line); + if (displayLinkNumber) + { + Str t = getLinkNumberStr(-1); + feed_table_inline_tag(tbl, NULL, mode, t->length); + Strcat(tmp, t); + } pushdata(tbl, tbl->row, tbl->col, tmp->ptr); } else |