aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog10
-rw-r--r--buffer.c13
-rw-r--r--display.c19
3 files changed, 35 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 10f1b47..5c6b33e 100644
--- 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
@@ -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 $
diff --git a/buffer.c b/buffer.c
index bb6423f..de1908f 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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)
diff --git a/display.c b/display.c
index aeca594..fd476c0 100644
--- a/display.c
+++ b/display.c
@@ -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);
}