w3m

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

commit 92c102b25e59054ea207df6034a69bf3edf0593c
parent d6c2c4a59ea00204881e9fd0040ca3104eeb40a2
Author: ukai <ukai>
Date:   Wed, 29 Jan 2003 17:38:12 +0000

[w3m-dev 03709] Re: view source, edit source
* display.c (displayBuffer): INIT_BUFFER_WIDTH
* file.c (_saveBuffer): added
	(saveBuffer): use _saveBuffer
	(saveBufferBody): added
* main.c (vmSrc): saveBufferBody
* proto.h (saveBufferBody): added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 10++++++++++
Mdisplay.c | 10+++++-----
Mfile.c | 21++++++++++++++++++---
Mmain.c | 2+-
Mproto.h | 1+
5 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,15 @@ 2003-01-30 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03709] Re: view source, edit source + * display.c (displayBuffer): INIT_BUFFER_WIDTH + * file.c (_saveBuffer): added + (saveBuffer): use _saveBuffer + (saveBufferBody): added + * main.c (vmSrc): saveBufferBody + * proto.h (saveBufferBody): added + +2003-01-30 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev-en 00852] Re: Enhancement: content type detection of files * url.c (DefaultGuess): remove upppercases (guessContentTypeFromTable): rewrite, strcasecmp diff --git a/display.c b/display.c @@ -360,13 +360,13 @@ displayBuffer(Buffer *buf, int mode) } if (buf->width == 0) - buf->width = COLS; + buf->width = INIT_BUFFER_WIDTH; if (buf->height == 0) buf->height = LASTLINE + 1; - if ((buf->width != INIT_BUFFER_WIDTH && ((buf->type && - !strcmp(buf->type, "text/html")) - || FoldLine)) - || buf->need_reshape) { + if (buf->sourcefile && + ((buf->width != INIT_BUFFER_WIDTH && + ((buf->type && !strcmp(buf->type, "text/html")) || FoldLine)) + || buf->need_reshape)) { buf->need_reshape = TRUE; reshapeBuffer(buf); } diff --git a/file.c b/file.c @@ -6963,10 +6963,9 @@ conv_rule(Line *l) /* * saveBuffer: write buffer to file */ -void -saveBuffer(Buffer *buf, FILE * f, int cont) +static void +_saveBuffer(Buffer *buf, Line *l, FILE * f, int cont) { - Line *l = buf->firstLine; Str tmp; #ifndef KANJI_SYMBOLS @@ -6995,6 +6994,22 @@ saveBuffer(Buffer *buf, FILE * f, int cont) } } +void +saveBuffer(Buffer *buf, FILE * f, int cont) +{ + _saveBuffer(buf, buf->firstLine, f, cont); +} + +void +saveBufferBody(Buffer *buf, FILE * f, int cont) +{ + Line *l = buf->firstLine; + + while (l != NULL && l->real_linenumber == 0) + l = l->next; + _saveBuffer(buf, l, f, cont); +} + static Buffer * loadcmdout(char *cmd, Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf) diff --git a/main.c b/main.c @@ -4399,7 +4399,7 @@ vwSrc(void) f = fopen(tmpf->ptr, "w"); if (f == NULL) return; - saveBuffer(Currentbuf, f, TRUE); + saveBufferBody(Currentbuf, f, TRUE); fclose(f); Currentbuf->sourcefile = tmpf->ptr; } diff --git a/proto.h b/proto.h @@ -226,6 +226,7 @@ extern Buffer *loadBuffer(URLFile *uf, Buffer *newBuf); extern Buffer *loadImageBuffer(URLFile *uf, Buffer *newBuf); #endif extern void saveBuffer(Buffer *buf, FILE * f, int cont); +extern void saveBufferBody(Buffer *buf, FILE * f, int cont); extern Buffer *getshell(char *cmd); extern Buffer *getpipe(char *cmd); extern Buffer *openPagerBuffer(InputStream stream, Buffer *buf);