[w3m-dev 03620] -m option and header

* buffer.c (reshapeBuffer): fix reading from stdin
			fix -m option
* display.c (redrawNLine): rewrite
	(redrawLine): return l instead of l->next
	(redrawLineImage): ditto
* file.c (loadFile): read header even if skip header
	(loadGeneralFile): read header even if skip header
* fm.h (SkipHeader): added
* main.c (main): check whether reading from stdin
		SkipHeader
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2003-01-10 16:08:19 +00:00
parent 0cf4f52a13
commit 900d16573c
6 changed files with 53 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.49 2002/12/27 16:46:13 ukai Exp $ */
/* $Id: display.c,v 1.50 2003/01/10 16:08:20 ukai Exp $ */
#include <signal.h>
#include "fm.h"
@@ -561,7 +561,7 @@ drawAnchorCursor(Buffer *buf)
static void
redrawNLine(Buffer *buf, int n)
{
Line *l, *l0;
Line *l;
int i;
#ifdef USE_COLOR
@@ -616,19 +616,13 @@ redrawNLine(Buffer *buf, int n)
for (i = 0; i < COLS; i++)
addch('~');
}
for (i = 0, l = buf->topLine; i < buf->LINES; i++) {
for (i = 0, l = buf->topLine; i < buf->LINES; i++, l = l->next) {
if (i >= buf->LINES - n || i < -n)
l0 = redrawLine(buf, l, i + buf->rootY);
else {
l0 = (l) ? l->next : NULL;
}
if (l0 == NULL && l == NULL)
l = redrawLine(buf, l, i + buf->rootY);
if (l == NULL)
break;
l = l0;
}
if (n > 0) {
if (i == 0 && buf->topLine != NULL)
i++;
move(i + buf->rootY, 0);
clrtobotx();
}
@@ -637,15 +631,9 @@ redrawNLine(Buffer *buf, int n)
if (!(activeImage && displayImage && buf->img))
return;
move(buf->cursorY + buf->rootY, buf->cursorX + buf->rootX);
for (i = 0, l = buf->topLine; i < buf->LINES; i++) {
for (i = 0, l = buf->topLine; i < buf->LINES && l; i++, l = l->next) {
if (i >= buf->LINES - n || i < -n)
l0 = redrawLineImage(buf, l, i + buf->rootY);
else {
l0 = (l) ? l->next : NULL;
}
if (l0 == NULL && l == NULL)
break;
l = l0;
redrawLineImage(buf, l, i + buf->rootY);
}
getAllImage(buf);
#endif
@@ -702,7 +690,7 @@ redrawLine(Buffer *buf, Line *l, int i)
l->width = COLPOS(l, l->len);
if (l->len == 0 || l->width - 1 < column) {
clrtoeolx();
return l->next;
return l;
}
/* need_clrtoeol(); */
pos = columnPos(l, column);
@@ -818,7 +806,7 @@ redrawLine(Buffer *buf, Line *l, int i)
#endif
if (rcol - column < buf->COLS)
clrtoeolx();
return l->next;
return l;
}
#ifdef USE_IMAGE
@@ -835,7 +823,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
if (l->width < 0)
l->width = COLPOS(l, l->len);
if (l->len == 0 || l->width - 1 < column)
return l->next;
return l;
pos = columnPos(l, column);
rcol = COLPOS(l, pos);
for (j = 0; rcol - column < buf->COLS && pos + j < l->len; j++) {
@@ -888,7 +876,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
}
rcol = COLPOS(l, pos + j + 1);
}
return l->next;
return l;
}
#endif