w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit ea07953b4ddb1a7476174a9b036edfae3a501134
parent 13e73cddc715f404e095e91a29f2bf497e5a5221
Author: ukai <ukai>
Date:   Fri, 13 Dec 2002 02:19:01 +0000

[w3m-dev 03564] clean up displayBuffer()
* display.c (delayed_msg): static
	(drawAnchorCursor): static
	(redrawBuffer): define
	(redrawNLine): static
	(redrawLine): static
	(redrawLineRegion): static
	(do_effects): static
	(do_color): static
	(make_lastline_link): added
	(make_lastline_message): added
	(displayBuffer): rewrite with make_lastline_message()
	(drawAnchorCursor0): added
	(drawAnchorCursor): added
* main.c (main): remove onA()
	(keyPressEventProc): remove onA()
	(disp_srchresult): static
		disp_message TRUE
	(isrch): remove onA()
	(srch): displayBuffer
		remove onA()
	(srch_nxtprv): remove onA()
	(pipeBuf): disp_message TRUE
	(pipesh): disp_message TRUE
	(readsh): disp_message TRUE
	(_mark): dispBuffer
	(_followForm): break, always dispBuffer
	(drawAnchorCursor0): deleted
	(drawAnchorCursor): deleted
	(onA): deleted
	(anchorMn): delete onA()
	(svBuf): displayBuffer B_NORMAL
	(reload): disp_err_message TRUE
		displayBuffer
	(rFrame): displayBuffer
	(invoke_browser): displayBuffer
	(extbrz): disp_err_message TRUE
	(process_mouse): onA -> displayBuffer
	(movMs): delete onA()
	(menuMs): onA -> displayBuffer
	(closeTMs): disp_message TRUE
	(wrapToggle): disp_message TRUE
	(execdict): disp_message TRUE
	(SigAlarm): displayBuffer, delete onA
	(reinit): displayBuffer
* map.c (getCurrentMapLabel): deleted
	(retrieveCurrentMapArea): added
* proto.h (redrawBuffer): deleted
	(redrawNLine): deleted
	(redrawLine): deleted
	(redrawLineRegion): deleted
	(do_effects): deleted
	(do_color): deleted
	(message_list): deleted
	(getCurrentMapLabel): deleted
	(retrieveCurrentMapArea): added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdisplay.c | 306++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
Mmain.c | 172++++++++++++++++++++++---------------------------------------------------------
Mmap.c | 21++++-----------------
Mproto.h | 11+----------
5 files changed, 322 insertions(+), 247 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,64 @@ 2002-12-13 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03564] clean up displayBuffer() + * display.c (delayed_msg): static + (drawAnchorCursor): static + (redrawBuffer): define + (redrawNLine): static + (redrawLine): static + (redrawLineRegion): static + (do_effects): static + (do_color): static + (make_lastline_link): added + (make_lastline_message): added + (displayBuffer): rewrite with make_lastline_message() + (drawAnchorCursor0): added + (drawAnchorCursor): added + * main.c (main): remove onA() + (keyPressEventProc): remove onA() + (disp_srchresult): static + disp_message TRUE + (isrch): remove onA() + (srch): displayBuffer + remove onA() + (srch_nxtprv): remove onA() + (pipeBuf): disp_message TRUE + (pipesh): disp_message TRUE + (readsh): disp_message TRUE + (_mark): dispBuffer + (_followForm): break, always dispBuffer + (drawAnchorCursor0): deleted + (drawAnchorCursor): deleted + (onA): deleted + (anchorMn): delete onA() + (svBuf): displayBuffer B_NORMAL + (reload): disp_err_message TRUE + displayBuffer + (rFrame): displayBuffer + (invoke_browser): displayBuffer + (extbrz): disp_err_message TRUE + (process_mouse): onA -> displayBuffer + (movMs): delete onA() + (menuMs): onA -> displayBuffer + (closeTMs): disp_message TRUE + (wrapToggle): disp_message TRUE + (execdict): disp_message TRUE + (SigAlarm): displayBuffer, delete onA + (reinit): displayBuffer + * map.c (getCurrentMapLabel): deleted + (retrieveCurrentMapArea): added + * proto.h (redrawBuffer): deleted + (redrawNLine): deleted + (redrawLine): deleted + (redrawLineRegion): deleted + (do_effects): deleted + (do_color): deleted + (message_list): deleted + (getCurrentMapLabel): deleted + (retrieveCurrentMapArea): added + +2002-12-13 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03563] Directory Traversal Vulnerabilities in FTP Clients * file.c (guess_save_name): pass guess_filename diff --git a/display.c b/display.c @@ -214,19 +214,145 @@ static Linecolor color_mode = 0; static Buffer *save_current_buf = NULL; #endif -char *delayed_msg = NULL; +static char *delayed_msg = NULL; +static void drawAnchorCursor(Buffer *buf); +#define redrawBuffer(buf) redrawNLine(buf, LASTLINE) +static void redrawNLine(Buffer *buf, int n); +static Line *redrawLine(Buffer *buf, Line *l, int i); #ifdef USE_IMAGE static int image_touch = 0; static int draw_image_flag = FALSE; static Line *redrawLineImage(Buffer *buf, Line *l, int i); #endif +static int redrawLineRegion(Buffer *buf, Line *l, int i, int bpos, int epos); +static void do_effects(Lineprop m); +#ifdef USE_ANSI_COLOR +static void do_color(Linecolor c); +#endif + +static Str +make_lastline_link(Buffer *buf, char *title, char *url) +{ + Str s = NULL, u; + ParsedURL pu; + char *p; + int l = COLS - 1; + + if (title && *title) { + s = Strnew_m_charp("[", title, "]", NULL); + for (p = s->ptr; *p; p++) { + if (IS_CNTRL(*p) || IS_SPACE(*p)) + *p = ' '; + } + if (url) + Strcat_charp(s, " "); + l -= s->length; + if (l <= 0) + return s; + } + if (!url) + return s; + parseURL2(url, &pu, baseURL(buf)); + u = parsedURL2Str(&pu); + if (l <= 4 || l >= u->length) { + if (!s) + return u; + Strcat(s, u); + return s; + } + if (!s) + s = Strnew_size(COLS); + Strcat_charp_n(s, u->ptr, (l - 2) / 2); +#if LANG == JA + Strcat_charp(s, "กฤ"); +#else /* LANG != JA */ + Strcat_charp(s, ".."); +#endif /* LANG != JA */ + l = COLS - 1 - s->length; + Strcat_charp(s, &u->ptr[u->length - l]); + return s; +} + +static Str +make_lastline_message(Buffer *buf) +{ + Str msg, s = NULL; + + if (displayLink) { +#ifdef USE_IMAGE + MapArea *a = retrieveCurrentMapArea(buf); + if (a) + s = make_lastline_link(buf, a->alt, a->url); + else +#endif + { + Anchor *a = retrieveCurrentAnchor(buf); + char *p = NULL; + if (a && a->title && *a->title) + p = a->title; + else { + Anchor *a_img = retrieveCurrentImg(buf); + if (a_img && a_img->title && *a_img->title) + p = a_img->title; + } + if (p || a) + s = make_lastline_link(buf, p, a ? a->url : NULL); + } + if (s && s->length >= COLS - 3) + return s; + } + +#ifdef USE_MOUSE + if (use_mouse && mouse_action.lastline_str) + msg = Strnew_charp(mouse_action.lastline_str); + else +#endif /* not USE_MOUSE */ + msg = Strnew(); + if (displayLineInfo && buf->currentLine != NULL && buf->lastLine != NULL) { + int cl = buf->currentLine->real_linenumber; + int ll = buf->lastLine->real_linenumber; + int r = (int)((double)cl * 100.0 / (double)(ll ? ll : 1) + 0.5); + Strcat(msg, Sprintf("%d/%d (%d%%)", cl, ll, r)); + } + else + Strcat_charp(msg, "Viewing"); +#ifdef USE_SSL + if (buf->ssl_certificate) + Strcat_charp(msg, "[SSL]"); +#endif + Strcat_charp(msg, " <"); + Strcat_charp(msg, buf->buffername); + + if (s) { + int l = COLS - 3 - s->length; +#ifdef JP_CHARSET + if (msg->length > l) { + char *p; + int i; + for (p = msg->ptr; *p; p += i) { + i = get_mclen(get_mctype(p)); + l -= i; + if (l < 0) + break; + } + l = p - msg->ptr; +#endif + Strtruncate(msg, l); + } + Strcat_charp(msg, "> "); + Strcat(msg, s); + } + else { + Strcat_charp(msg, ">"); + } + return msg; +} void displayBuffer(Buffer *buf, int mode) { Str msg; - Str s = NULL; int ny = 0; if (buf->topLine == NULL && readBufferCache(buf) == 0) { /* clear_buffer */ @@ -321,89 +447,9 @@ displayBuffer(Buffer *buf, int mode) } #endif -#ifdef USE_MOUSE - if (use_mouse && mouse_action.lastline_str) - msg = Strnew_charp(mouse_action.lastline_str); - else -#endif /* not USE_MOUSE */ - msg = Strnew(); - if (displayLineInfo && buf->currentLine != NULL && buf->lastLine != NULL) { - int cl = buf->currentLine->real_linenumber; - int ll = buf->lastLine->real_linenumber; - int r = (int)((double)cl * 100.0 / (double)(ll ? ll : 1) + 0.5); - Strcat(msg, Sprintf("%d/%d (%d%%)", cl, ll, r)); - } - else - Strcat_charp(msg, "Viewing"); -#ifdef USE_SSL - if (buf->ssl_certificate) - Strcat_charp(msg, "[SSL]"); -#endif - Strcat_charp(msg, " <"); - Strcat_charp(msg, buf->buffername); - if (displayLink) { -#ifdef USE_IMAGE - s = getCurrentMapLabel(buf); - if (!s) -#endif - { - Anchor *a = retrieveCurrentAnchor(buf); - if (a && a->title && *a->title) - s = Sprintf("[%s] ", a->title); - else { - Anchor *a_img = retrieveCurrentImg(buf); - if (a_img && a_img->title && *a_img->title) - s = Sprintf("[%s]%s", a_img->title, a ? " " : ""); - } - if (a) { - ParsedURL pu; - parseURL2(a->url, &pu, baseURL(buf)); - if (!s) - s = Strnew(); - Strcat(s, parsedURL2Str(&pu)); - } - } - } - if (s) { - int l; - l = buf->width - 2; - if (s->length > l) { - if (l >= 4) { - msg = Strsubstr(s, 0, (l - 2) / 2); -#if LANG == JA - Strcat_charp(msg, "กฤ"); -#else /* LANG != JA */ - Strcat_charp(msg, ".."); -#endif /* LANG != JA */ - l = buf->width - msg->length; - Strcat(msg, Strsubstr(s, s->length - l, l)); - } - else { - msg = s; - } - } - else { - l -= s->length; - if (msg->length > l) { -#ifdef JP_CHARSET - char *bn = msg->ptr; - int i, j; - for (i = 0; bn[i]; i += j) { - j = get_mclen(get_mctype(&bn[i])); - if (i + j > l) - break; - } - l = i; -#endif - Strtruncate(msg, l); - } - Strcat_charp(msg, "> "); - Strcat(msg, s); - } - } - else { - Strcat_charp(msg, ">"); - } + drawAnchorCursor(buf); + + msg = make_lastline_message(buf); if (buf->firstLine == NULL) { Strcat_charp(msg, "\tNo Line"); clear(); @@ -434,13 +480,83 @@ displayBuffer(Buffer *buf, int mode) #endif } -void -redrawBuffer(Buffer *buf) +static void +drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, + int tline, int eline, int active) +{ + int i, j; + Line *l; + Anchor *an; + + l = buf->topLine; + for (j = 0; j < al->nanchor; j++) { + an = &al->anchors[j]; + if (an->start.line < tline) + continue; + if (an->start.line >= eline) + return; + for (;; l = l->next) { + if (l == NULL) + return; + if (l->linenumber == an->start.line) + break; + } + if (hseq >= 0 && an->hseq == hseq) { + for (i = an->start.pos; i < an->end.pos; i++) { + if (l->propBuf[i] & (PE_IMAGE | PE_ANCHOR | PE_FORM)) { + if (active) + l->propBuf[i] |= PE_ACTIVE; + else + l->propBuf[i] &= ~PE_ACTIVE; + } + } + if (active) + redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, + an->start.pos, an->end.pos); + } + else if (prevhseq >= 0 && an->hseq == prevhseq) { + if (active) + redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, + an->start.pos, an->end.pos); + } + } +} + +static void +drawAnchorCursor(Buffer *buf) { - redrawNLine(buf, LASTLINE); + Anchor *an; + int hseq, prevhseq; + int tline, eline; + + if (!buf->firstLine || !buf->hmarklist) + return; + if (!buf->href && !buf->formitem) + return; + + an = retrieveCurrentAnchor(buf); + if (!an) + an = retrieveCurrentMap(buf); + if (an) + hseq = an->hseq; + else + hseq = -1; + tline = buf->topLine->linenumber; + eline = tline + buf->LINES; + prevhseq = buf->hmarklist->prevhseq; + + if (buf->href) { + drawAnchorCursor0(buf, buf->href, hseq, prevhseq, tline, eline, 1); + drawAnchorCursor0(buf, buf->href, hseq, -1, tline, eline, 0); + } + if (buf->formitem) { + drawAnchorCursor0(buf, buf->formitem, hseq, prevhseq, tline, eline, 1); + drawAnchorCursor0(buf, buf->formitem, hseq, -1, tline, eline, 0); + } + buf->hmarklist->prevhseq = hseq; } -void +static void redrawNLine(Buffer *buf, int n) { Line *l, *l0; @@ -536,7 +652,7 @@ redrawNLine(Buffer *buf, int n) #define addKanji(pc,pr) (addChar((pc)[0],(pr)[0]),addChar((pc)[1],(pr)[1])) -Line * +static Line * redrawLine(Buffer *buf, Line *l, int i) { int j, pos, rcol, ncol, delta; @@ -705,7 +821,7 @@ redrawLine(Buffer *buf, Line *l, int i) } #ifdef USE_IMAGE -Line * +static Line * redrawLineImage(Buffer *buf, Line *l, int i) { int j, pos, rcol; @@ -775,7 +891,7 @@ redrawLineImage(Buffer *buf, Line *l, int i) } #endif -int +static int redrawLineRegion(Buffer *buf, Line *l, int i, int bpos, int epos) { int j, pos, rcol, ncol, delta; @@ -928,7 +1044,7 @@ if (modeflag) { \ modeflag = FALSE; \ } -void +static void do_effects(Lineprop m) { /* effect end */ @@ -973,7 +1089,7 @@ do_effects(Lineprop m) } #ifdef USE_ANSI_COLOR -void +static void do_color(Linecolor c) { if (c & 0x8) @@ -1026,7 +1142,7 @@ addChar(char c, Lineprop mode) addch(' '); } -GeneralList *message_list = NULL; +static GeneralList *message_list = NULL; void record_err_message(char *s) diff --git a/main.c b/main.c @@ -988,7 +988,6 @@ main(int argc, char **argv, char **envp) if (line_str) { _goLine(line_str); } - onA(); for (;;) { if (Currentbuf->submit) { Anchor *a = Currentbuf->submit; @@ -1086,7 +1085,6 @@ keyPressEventProc(int c) { CurrentKey = c; w3mFuncList[(int)GlobalKeymap[c]].func(); - onA(); } void @@ -1531,17 +1529,17 @@ srchcore(char *str, int (*func) (Buffer *, char *)) return result; } -void +static void disp_srchresult(int result, char *prompt, char *str) { if (str == NULL) str = ""; if (result & SR_NOTFOUND) - disp_message(Sprintf("Not found: %s", str)->ptr, FALSE); + disp_message(Sprintf("Not found: %s", str)->ptr, TRUE); else if (result & SR_WRAPPED) - disp_message(Sprintf("Search wrapped: %s", str)->ptr, FALSE); + disp_message(Sprintf("Search wrapped: %s", str)->ptr, TRUE); else if (show_srch_str) - disp_message(Sprintf("%s%s", prompt, str)->ptr, FALSE); + disp_message(Sprintf("%s%s", prompt, str)->ptr, TRUE); } static int @@ -1636,7 +1634,6 @@ isrch(int (*func) (Buffer *, char *), char *prompt) RESTORE_BUFPOSITION(&sbuf); } displayBuffer(Currentbuf, B_FORCE_REDRAW); - onA(); } void @@ -1648,13 +1645,14 @@ srch(int (*func) (Buffer *, char *), char *prompt) str = inputStrHist(prompt, NULL, TextHist); if (str != NULL && *str == '\0') str = SearchString; - if (str == NULL) + if (str == NULL) { + displayBuffer(Currentbuf, B_NORMAL); return; + } result = srchcore(str, func); if (result & SR_FOUND) clear_mark(Currentbuf->currentLine); displayBuffer(Currentbuf, B_NORMAL); - onA(); disp_srchresult(result, prompt, str); searchRoutine = func; } @@ -1709,7 +1707,6 @@ srch_nxtprv(int reverse) if (result & SR_FOUND) clear_mark(Currentbuf->currentLine); displayBuffer(Currentbuf, B_NORMAL); - onA(); disp_srchresult(result, (reverse ? "Backward: " : "Forward: "), SearchString); } @@ -1858,7 +1855,8 @@ pipeBuf(void) pushText(fileToDelete, tmpf); buf = getpipe(myExtCommand(cmd, tmpf, TRUE)->ptr); if (buf == NULL) { - disp_message("Execution failed", FALSE); + disp_message("Execution failed", TRUE); + return; } else { buf->bufferprop |= (BP_INTERNAL | BP_NO_URL); @@ -1889,7 +1887,8 @@ pipesh(void) } buf = getpipe(cmd); if (buf == NULL) { - disp_message("Execution failed", FALSE); + disp_message("Execution failed", TRUE); + return; } else { buf->bufferprop |= (BP_INTERNAL | BP_NO_URL); @@ -1925,7 +1924,8 @@ readsh(void) signal(SIGINT, prevtrap); term_raw(); if (buf == NULL) { - disp_message("Execution failed", FALSE); + disp_message("Execution failed", TRUE); + return; } else { buf->bufferprop |= (BP_INTERNAL | BP_NO_URL); @@ -2543,8 +2543,7 @@ _mark(void) return; l = Currentbuf->currentLine; l->propBuf[Currentbuf->pos] ^= PE_MARK; - redrawLine(Currentbuf, l, l->linenumber - Currentbuf->topLine->linenumber - + Currentbuf->rootY); + displayBuffer(Currentbuf, B_NORMAL); } /* Go to next mark */ @@ -3178,7 +3177,7 @@ _followForm(int submit) disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE); p = inputStrHist("TEXT:", fi->value ? fi->value->ptr : NULL, TextHist); if (p == NULL || fi->readonly) - return; + break; fi->value = Strnew_charp(p); formUpdateBuffer(a, Currentbuf, fi); if (fi->accept || fi->parent->nitems == 1) @@ -3192,7 +3191,7 @@ _followForm(int submit) p = inputFilenameHist("Filename:", fi->value ? fi->value->ptr : NULL, NULL); if (p == NULL || fi->readonly) - return; + break; fi->value = Strnew_charp(p); formUpdateBuffer(a, Currentbuf, fi); if (fi->accept || fi->parent->nitems == 1) @@ -3203,12 +3202,12 @@ _followForm(int submit) goto do_submit; if (fi->readonly) { disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE); - return; + break; } p = inputLine("Password:", fi->value ? fi->value->ptr : NULL, IN_PASSWORD); if (p == NULL) - return; + break; fi->value = Strnew_charp(p); formUpdateBuffer(a, Currentbuf, fi); if (fi->accept) @@ -3227,7 +3226,7 @@ _followForm(int submit) goto do_submit; if (fi->readonly) { disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE); - return; + break; } formRecheckRadio(a, Currentbuf, fi); break; @@ -3236,7 +3235,7 @@ _followForm(int submit) goto do_submit; if (fi->readonly) { disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE); - return; + break; } fi->checked = !fi->checked; formUpdateBuffer(a, Currentbuf, fi); @@ -3335,91 +3334,6 @@ _followForm(int submit) displayBuffer(Currentbuf, B_FORCE_REDRAW); } -static void -drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, - int tline, int eline, int active) -{ - int i, j; - Line *l; - Anchor *an; - - l = buf->topLine; - for (j = 0; j < al->nanchor; j++) { - an = &al->anchors[j]; - if (an->start.line < tline) - continue; - if (an->start.line >= eline) - return; - for (;; l = l->next) { - if (l == NULL) - return; - if (l->linenumber == an->start.line) - break; - } - if (hseq >= 0 && an->hseq == hseq) { - for (i = an->start.pos; i < an->end.pos; i++) { - if (l->propBuf[i] & (PE_IMAGE | PE_ANCHOR | PE_FORM)) { - if (active) - l->propBuf[i] |= PE_ACTIVE; - else - l->propBuf[i] &= ~PE_ACTIVE; - } - } - if (active) - redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, - an->start.pos, an->end.pos); - } - else if (prevhseq >= 0 && an->hseq == prevhseq) { - if (active) - redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, - an->start.pos, an->end.pos); - } - } -} - - -void -drawAnchorCursor(Buffer *buf) -{ - Anchor *an; - int hseq, prevhseq; - int tline, eline; - - if (!buf->firstLine || !buf->hmarklist) - return; - if (!buf->href && !buf->formitem) - return; - - an = retrieveCurrentAnchor(buf); - if (!an) - an = retrieveCurrentMap(buf); - if (an) - hseq = an->hseq; - else - hseq = -1; - tline = buf->topLine->linenumber; - eline = tline + buf->LINES; - prevhseq = buf->hmarklist->prevhseq; - - if (buf->href) { - drawAnchorCursor0(buf, buf->href, hseq, prevhseq, tline, eline, 1); - drawAnchorCursor0(buf, buf->href, hseq, -1, tline, eline, 0); - } - if (buf->formitem) { - drawAnchorCursor0(buf, buf->formitem, hseq, prevhseq, tline, eline, 1); - drawAnchorCursor0(buf, buf->formitem, hseq, -1, tline, eline, 0); - } - buf->hmarklist->prevhseq = hseq; -} - -/* underline an anchor if cursor is on the anchor. */ -void -onA(void) -{ - drawAnchorCursor(Currentbuf); - displayBuffer(Currentbuf, B_NORMAL); -} - /* go to the top anchor */ void topA(void) @@ -4197,10 +4111,8 @@ anchorMn(Anchor *(*menu_func) (Buffer *), int go) Currentbuf->pos = po->pos; arrangeCursor(Currentbuf); displayBuffer(Currentbuf, B_NORMAL); - if (go) { - onA(); + if (go) followA(); - } } /* accesskey */ @@ -4294,7 +4206,7 @@ svBuf(void) if (file == NULL || *file == '\0') { qfile = inputLineHist("Save buffer to: ", NULL, IN_COMMAND, SaveHist); if (qfile == NULL || *qfile == '\0') { - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_NORMAL); return; } } @@ -4309,8 +4221,10 @@ svBuf(void) file = conv_to_system(file); } file = expandName(file); - if (checkOverWrite(file) < 0) + if (checkOverWrite(file) < 0) { + displayBuffer(Currentbuf, B_NORMAL); return; + } f = fopen(file, "w"); is_pipe = FALSE; } @@ -4548,7 +4462,7 @@ reload(void) ldDL(); return; } - disp_err_message("Can't reload...", FALSE); + disp_err_message("Can't reload...", TRUE); return; } if (Currentbuf->currentURL.scheme == SCM_LOCAL && @@ -4564,8 +4478,10 @@ reload(void) message("Rendering frame", 0, 0); refresh(); } - if (!(buf = renderFrame(fbuf, 1))) + if (!(buf = renderFrame(fbuf, 1))) { + displayBuffer(Currentbuf, B_NORMAL); return; + } if (fbuf->linkBuffer[LB_FRAME]) { if (buf->sourcefile && fbuf->linkBuffer[LB_FRAME]->sourcefile && @@ -4621,10 +4537,11 @@ reload(void) if (multipart) unlink(request->body); if (buf == NULL) { - disp_err_message("Can't reload...", FALSE); + disp_err_message("Can't reload...", TRUE); return; } else if (buf == NO_BUFFER) { + displayBuffer(Currentbuf, B_NORMAL); return; } if (fbuf != NULL) @@ -4746,8 +4663,10 @@ rFrame(void) refresh(); } buf = renderFrame(Currentbuf, 0); - if (buf == NULL) + if (buf == NULL) { + displayBuffer(Currentbuf, B_NORMAL); return; + } buf->linkBuffer[LB_N_FRAME] = Currentbuf; Currentbuf->linkBuffer[LB_FRAME] = buf; pushBuffer(buf); @@ -4787,8 +4706,10 @@ invoke_browser(char *url) else { browser = conv_to_system(browser); } - if (browser == NULL || *browser == '\0') + if (browser == NULL || *browser == '\0') { + displayBuffer(Currentbuf, B_NORMAL); return; + } if ((len = strlen(browser)) >= 2 && browser[len - 1] == '&' && browser[len - 2] != '\\') { @@ -4807,7 +4728,7 @@ void extbrz() { if (Currentbuf->bufferprop & BP_INTERNAL) { - disp_err_message("Can't browse...", FALSE); + disp_err_message("Can't browse...", TRUE); return; } if (Currentbuf->currentURL.scheme == SCM_LOCAL && @@ -5055,7 +4976,7 @@ process_mouse(int btn, int x, int y) - Currentbuf->rootX - 1) #endif )) { - onA(); + displayBuffer(Currentbuf, B_NORMAL); followTab(t); } if (buf == Currentbuf) @@ -5230,7 +5151,6 @@ movMs(void) mouse_action.cursorY < LASTLINE) { cursorXY(Currentbuf, mouse_action.cursorX - Currentbuf->rootX, mouse_action.cursorY - Currentbuf->rootY); - onA(); } displayBuffer(Currentbuf, B_NORMAL); } @@ -5253,7 +5173,7 @@ menuMs(void) mouse_action.cursorY < LASTLINE) { cursorXY(Currentbuf, mouse_action.cursorX - Currentbuf->rootX, mouse_action.cursorY - Currentbuf->rootY); - onA(); + displayBuffer(Currentbuf, B_NORMAL); } mainMn(); } @@ -5291,7 +5211,7 @@ closeTMs(void) void dispVer() { - disp_message(Sprintf("w3m version %s", w3m_version)->ptr, FALSE); + disp_message(Sprintf("w3m version %s", w3m_version)->ptr, TRUE); } void @@ -5299,11 +5219,11 @@ wrapToggle(void) { if (WrapSearch) { WrapSearch = FALSE; - disp_message("Wrap search off", FALSE); + disp_message("Wrap search off", TRUE); } else { WrapSearch = TRUE; - disp_message("Wrap search on", FALSE); + disp_message("Wrap search on", TRUE); } } @@ -5375,7 +5295,8 @@ execdict(char *word) Str_form_quote(Strnew_charp(w))->ptr)->ptr; buf = loadGeneralFile(dictcmd, NULL, NO_REFERER, 0, NULL); if (buf == NULL) { - disp_message("Execution failed", FALSE); + disp_message("Execution failed", TRUE); + return; } else { buf->filename = w; @@ -5584,12 +5505,12 @@ SigAlarm(SIGNAL_ARG) mouse_inactive(); #endif w3mFuncList[CurrentAlarm.cmd].func(); + displayBuffer(Currentbuf, B_NORMAL); #ifdef USE_MOUSE if (use_mouse) mouse_active(); #endif CurrentCmdData = NULL; - onA(); if (CurrentAlarm.status & AL_IMPLICIT) { CurrentAlarm.buffer = Currentbuf; CurrentAlarm.status = AL_IMPLICIT_DONE @@ -5714,6 +5635,7 @@ reinit() #ifdef USE_MOUSE if (!strcasecmp(resource, "MOUSE")) { initMouseAction(); + displayBuffer(Currentbuf, B_NORMAL); return; } #endif diff --git a/map.c b/map.c @@ -128,8 +128,8 @@ searchMapArea(Buffer *buf, MapList *ml, Anchor *a_img) return n; } -Str -getCurrentMapLabel(Buffer *buf) +MapArea * +retrieveCurrentMapArea(Buffer *buf) { Anchor *a_img, *a_form; FormItemList *fi; @@ -137,7 +137,6 @@ getCurrentMapLabel(Buffer *buf) ListItem *al; MapArea *a; int i, n; - Str s = NULL; a_img = retrieveCurrentImg(buf); if (!(a_img && a_img->image && a_img->image->map)) @@ -157,20 +156,8 @@ getCurrentMapLabel(Buffer *buf) return NULL; for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) { a = (MapArea *) al->ptr; - if (!(a && i == n)) - continue; - if (*a->alt) - s = Sprintf("[%s]", a->alt); - if (*a->url) { - ParsedURL pu; - parseURL2(a->url, &pu, baseURL(buf)); - if (s) - Strcat_char(s, ' '); - else - s = Strnew(); - Strcat(s, parsedURL2Str(&pu)); - } - return s; + if (a && i == n) + return a; } return NULL; } diff --git a/proto.h b/proto.h @@ -271,16 +271,7 @@ extern int readBufferCache(Buffer *buf); extern void fmTerm(void); extern void fmInit(void); extern void displayBuffer(Buffer *buf, int mode); -extern void redrawBuffer(Buffer *buf); -extern void redrawNLine(Buffer *buf, int n); -extern Line *redrawLine(Buffer *buf, Line *l, int i); -extern int redrawLineRegion(Buffer *buf, Line *l, int i, int bpos, int epos); -extern void do_effects(Lineprop m); -#ifdef USE_ANSI_COLOR -extern void do_color(Linecolor c); -#endif extern void addChar(char c, Lineprop mode); -extern GeneralList *message_list; extern void record_err_message(char *s); extern Buffer *message_list_panel(void); extern void message(char *s, int return_x, int return_y); @@ -390,7 +381,7 @@ extern Buffer *follow_map_panel(Buffer *buf, char *name); #endif #ifdef USE_IMAGE extern int getMapXY(Buffer *buf, Anchor *a, int *x, int *y); -extern Str getCurrentMapLabel(Buffer *buf); +extern MapArea *retrieveCurrentMapArea(Buffer *buf); #endif extern Anchor *retrieveCurrentMap(Buffer *buf); extern MapArea *newMapArea(char *url, char *target, char *alt, char *shape,