[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>
This commit is contained in:
Fumitoshi UKAI
2003-01-28 16:40:58 +00:00
parent b701883b27
commit 58259b5c34
3 changed files with 57 additions and 32 deletions
+7 -1
View File
@@ -1,3 +1,9 @@
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))
@@ -6886,4 +6892,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
$Id: ChangeLog,v 1.720 2003/01/28 16:36:49 ukai Exp $
$Id: ChangeLog,v 1.721 2003/01/28 16:40:58 ukai Exp $
+23 -14
View File
@@ -1,4 +1,4 @@
/* $Id: buffer.c,v 1.24 2003/01/25 18:06:25 ukai Exp $ */
/* $Id: buffer.c,v 1.25 2003/01/28 16:41:03 ukai Exp $ */
#include "fm.h"
#ifdef USE_MOUSE
@@ -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);
}
+27 -17
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.209 2003/01/24 17:57:54 ukai Exp $ */
/* $Id: file.c,v 1.210 2003/01/28 16:41:05 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -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;
}