w3m

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

commit 2e45ff98c9b00a9366589c92f841b68d50125f93
parent 3ed71e3cfbe7ba4846474dea431112433620f2b9
Author: ukai <ukai>
Date:   Tue, 28 Jan 2003 16:40:58 +0000

[w3m-dev 03706] X-Image-URL: support, bug fix of reshapeBuffer()
* buffer.c (reshapeBuffer): rewrite
* file.c (readHeader): rewrite
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 6++++++
Mbuffer.c | 35++++++++++++++++++++++-------------
Mfile.c | 42++++++++++++++++++++++++++----------------
3 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,11 @@ 2003-01-29 NAKAJIMA Mikio <minakaji@osaka.email.ne.jp> + * [w3m-dev 03706] X-Image-URL: support, bug fix of reshapeBuffer() + * buffer.c (reshapeBuffer): rewrite + * file.c (readHeader): rewrite + +2003-01-29 NAKAJIMA Mikio <minakaji@osaka.email.ne.jp> + * [w3m-dev 03705] goodict.cgi (was: Re: google.cgi (was: Re: keymap key SEARCH string)) * Bonus/goodict.cgi: added diff --git a/buffer.c b/buffer.c @@ -527,10 +527,6 @@ reshapeBuffer(Buffer *buf) buf->imarklist->nmark = 0; buf->width = INIT_BUFFER_WIDTH; -#ifdef JP_CHARSET - UseContentCharset = FALSE; - UseAutoDetect = FALSE; -#endif if (buf->header_source) { if (buf->currentURL.scheme != SCM_LOCAL || buf->mailcap_source || !strcmp(buf->currentURL.file, "-")) { @@ -546,6 +542,10 @@ reshapeBuffer(Buffer *buf) readHeader(&f, buf, TRUE, NULL); } +#ifdef JP_CHARSET + UseContentCharset = FALSE; + UseAutoDetect = FALSE; +#endif if (!strcasecmp(buf->type, "text/html")) loadHTMLBuffer(&f, buf); else @@ -558,20 +558,27 @@ reshapeBuffer(Buffer *buf) buf->height = LASTLINE + 1; if (buf->firstLine && sbuf.firstLine) { + Line *cur = sbuf.currentLine; int n; - buf->pos = sbuf.pos; - if (sbuf.currentLine) - buf->pos += sbuf.currentLine->bpos; - while (sbuf.currentLine->bpos && sbuf.currentLine->prev) - sbuf.currentLine = sbuf.currentLine->prev; - gotoRealLine(buf, sbuf.currentLine->real_linenumber); + + buf->pos = sbuf.pos + cur->bpos; + while (cur->bpos && cur->prev) + cur = cur->prev; + if (cur->real_linenumber > 0) + gotoRealLine(buf, cur->real_linenumber); + else + gotoLine(buf, cur->linenumber); n = (buf->currentLine->linenumber - buf->topLine->linenumber) - - (sbuf.currentLine->linenumber - sbuf.topLine->linenumber); + - (cur->linenumber - sbuf.topLine->linenumber); if (n) { buf->topLine = lineSkip(buf, buf->topLine, n, FALSE); - gotoRealLine(buf, sbuf.currentLine->real_linenumber); + if (cur->real_linenumber > 0) + gotoRealLine(buf, cur->real_linenumber); + else + gotoLine(buf, cur->linenumber); } - if (FoldLine) + buf->pos -= buf->currentLine->bpos; + if (FoldLine && strcasecmp(buf->type, "text/html")) buf->currentColumn = 0; else buf->currentColumn = sbuf.currentColumn; @@ -582,6 +589,8 @@ reshapeBuffer(Buffer *buf) #ifdef USE_NNTP if (buf->check_url & CHK_NMID) chkNMIDBuffer(buf); + if (buf->real_scheme == SCM_NNTP || buf->real_scheme == SCM_NEWS) + reAnchorNewsheader(buf); #endif formResetBuffer(buf, sbuf.formitem); } diff --git a/file.c b/file.c @@ -669,24 +669,34 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) for (; *q && (*q == '\r' || *q == '\n'); q++) ; } #ifdef USE_IMAGE + if (thru && activeImage && displayImage) { + Str src = NULL; + if (!strncasecmp(tmp->ptr, "X-Image-URL:", 12)) { + tmpf = &tmp->ptr[12]; + SKIP_BLANKS(tmpf); + src = Strnew_m_charp("<img src=\"", html_quote(tmpf), + "\" alt=\"X-Image-URL\">", NULL); + } #ifdef USE_XFACE - if (thru && activeImage && displayImage && - !strncasecmp(tmp->ptr, "X-Face:", 7) && - (tmpf = xface2xpm(&tmp->ptr[7])) != NULL) { - Str src; - URLFile f; - Line *l; - - src = Strnew_m_charp("<img src=\"file:", html_quote(tmpf), - "\" alt=\"X-Face\" width=48 height=48>", - NULL); - init_stream(&f, SCM_LOCAL, newStrStream(src)); - loadHTMLstream(&f, newBuf, NULL, TRUE); - for (l = newBuf->lastLine; l && l->real_linenumber; - l = l->prev) - l->real_linenumber = 0; - } + else if (!strncasecmp(tmp->ptr, "X-Face:", 7)) { + tmpf = xface2xpm(&tmp->ptr[7]); + if (tmpf) + src = Strnew_m_charp("<img src=\"file:", + html_quote(tmpf), + "\" alt=\"X-Face\"", + " width=48 height=48>", NULL); + } #endif + if (src) { + URLFile f; + Line *l; + init_stream(&f, SCM_LOCAL, newStrStream(src)); + loadHTMLstream(&f, newBuf, NULL, TRUE); + for (l = newBuf->lastLine; l && l->real_linenumber; + l = l->prev) + l->real_linenumber = 0; + } + } #endif lineBuf2 = tmp; }