w3m

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

commit eb74c413f1dc8b6d2c508e5e33d40b04cebf8414
parent 63bc4dc2c70d51b1527ed6a45a54b205840571bf
Author: ukai <ukai>
Date:   Fri, 24 Jan 2003 17:30:38 +0000

[w3m-dev 03681] Re: fold patch
* buffer.c (reshapeBuffer): buf->pos, sbuf.currentLine fix
			FoldLine
* display.c (arrangeCursor): buf->pos fix
	(restorePosition): buf->pos fix
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 8++++++++
Mbuffer.c | 11+++++++++--
Mdisplay.c | 17+++++++++++++++--
3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +2003-01-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03681] Re: fold patch + * buffer.c (reshapeBuffer): buf->pos, sbuf.currentLine fix + FoldLine + * display.c (arrangeCursor): buf->pos fix + (restorePosition): buf->pos fix + 2003-01-24 Fumitoshi UKAI <ukai@debian.or.jp> * NEWS: func: RESHAPE diff --git a/buffer.c b/buffer.c @@ -559,6 +559,11 @@ reshapeBuffer(Buffer *buf) buf->height = LASTLINE + 1; if (buf->firstLine && sbuf.firstLine) { 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); n = (buf->currentLine->linenumber - buf->topLine->linenumber) - (sbuf.currentLine->linenumber - sbuf.topLine->linenumber); @@ -566,8 +571,10 @@ reshapeBuffer(Buffer *buf) buf->topLine = lineSkip(buf, buf->topLine, n, FALSE); gotoRealLine(buf, sbuf.currentLine->real_linenumber); } - buf->pos = sbuf.pos; - buf->currentColumn = sbuf.currentColumn; + if (FoldLine) + buf->currentColumn = 0; + else + buf->currentColumn = sbuf.currentColumn; arrangeCursor(buf); } if (buf->check_url & CHK_URL) diff --git a/display.c b/display.c @@ -1413,7 +1413,7 @@ cursorHome(Buffer *buf) void arrangeCursor(Buffer *buf) { - int col, col2; + int col, col2, pos; int delta = 1; if (buf == NULL || buf->currentLine == NULL) return; @@ -1426,7 +1426,18 @@ arrangeCursor(Buffer *buf) buf->topLine = lineSkip(buf, buf->currentLine, 0, FALSE); } /* Arrange column */ - if (buf->currentLine->len == 0) + while (buf->pos < 0 && buf->currentLine->prev && buf->currentLine->bpos) { + pos = buf->pos + buf->currentLine->prev->len; + cursorUp0(buf, 1); + buf->pos = pos; + } + while (buf->pos >= buf->currentLine->len && buf->currentLine->next && + buf->currentLine->next->bpos) { + pos = buf->pos - buf->currentLine->len; + cursorDown0(buf, 1); + buf->pos = pos; + } + if (buf->currentLine->len == 0 || buf->pos < 0) buf->pos = 0; else if (buf->pos >= buf->currentLine->len) buf->pos = buf->currentLine->len - 1; @@ -1529,6 +1540,8 @@ restorePosition(Buffer *buf, Buffer *orig) FALSE); gotoLine(buf, CUR_LINENUMBER(orig)); buf->pos = orig->pos; + if (buf->currentLine && orig->currentLine) + buf->pos += orig->currentLine->bpos - buf->currentLine->bpos; buf->currentColumn = orig->currentColumn; arrangeCursor(buf); }