From 931a54afec82cbbc0eff2f08a3146de2aefe17f6 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 29 Jan 2003 17:38:12 +0000 Subject: [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 --- ChangeLog | 12 +++++++++++- display.c | 12 ++++++------ file.c | 23 +++++++++++++++++++---- main.c | 4 ++-- proto.h | 3 ++- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index d22db29..ce856c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-01-30 Hironori SAKAMOTO + + * [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 * [w3m-dev-en 00852] Re: Enhancement: content type detection of files @@ -6937,4 +6947,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.724 2003/01/29 17:33:28 ukai Exp $ +$Id: ChangeLog,v 1.725 2003/01/29 17:38:12 ukai Exp $ diff --git a/display.c b/display.c index 27cf475..beb916f 100644 --- a/display.c +++ b/display.c @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.59 2003/01/29 17:10:27 ukai Exp $ */ +/* $Id: display.c,v 1.60 2003/01/29 17:38:14 ukai Exp $ */ #include #include "fm.h" @@ -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 index 6010179..68537a9 100644 --- a/file.c +++ b/file.c @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.212 2003/01/29 17:26:51 ukai Exp $ */ +/* $Id: file.c,v 1.213 2003/01/29 17:38:14 ukai Exp $ */ #include "fm.h" #include #include "myctype.h" @@ -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 index 7bf596f..219f907 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.203 2003/01/29 17:10:41 ukai Exp $ */ +/* $Id: main.c,v 1.204 2003/01/29 17:38:15 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include @@ -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 index a343587..96b6b5a 100644 --- a/proto.h +++ b/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.85 2003/01/29 17:10:51 ukai Exp $ */ +/* $Id: proto.h,v 1.86 2003/01/29 17:38:15 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -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); -- cgit v1.2.3