diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | buffer.c | 13 | ||||
-rw-r--r-- | display.c | 19 |
3 files changed, 35 insertions, 7 deletions
@@ -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 @@ -6824,4 +6832,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.711 2003/01/23 18:44:26 ukai Exp $ +$Id: ChangeLog,v 1.712 2003/01/24 17:30:38 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.21 2003/01/23 18:38:04 ukai Exp $ */ +/* $Id: buffer.c,v 1.22 2003/01/24 17:30:50 ukai Exp $ */ #include "fm.h" #ifdef USE_MOUSE @@ -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) @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.55 2003/01/23 18:42:52 ukai Exp $ */ +/* $Id: display.c,v 1.56 2003/01/24 17:30:57 ukai Exp $ */ #include <signal.h> #include "fm.h" @@ -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); } |