diff -urN w3m/display.c w3m-fix/display.c --- w3m/display.c Fri May 26 19:32:24 2000 +++ w3m-fix/display.c Fri May 26 19:32:29 2000 @@ -712,25 +717,13 @@ void cursorUpDown(Buffer * buf, int n) { - int i, - cpos; Line *cl = buf->currentLine; if (buf->firstLine == NULL) return; if ((buf->currentLine = lineSkip(buf, cl, n, FALSE)) == cl) return; - buf->cursorY = buf->currentLine->linenumber - buf->topLine->linenumber; - i = columnPos(buf->currentLine, buf->currentColumn + buf->visualpos); - cpos = COLPOS(buf->currentLine, i) - buf->currentColumn; - if (cpos >= 0) { - buf->cursorX = cpos; - buf->pos = i; - } - else if (Currentbuf->currentLine->len > i) { - buf->cursorX = 0; - buf->pos = i + 1; - } + arrangeLine(buf); } void @@ -822,6 +815,27 @@ buf->cursorY = buf->currentLine->linenumber - buf->topLine->linenumber; buf->visualpos = buf->cursorX = COLPOS(buf->currentLine, buf->pos) - buf->currentColumn; +} + +void +arrangeLine(Buffer *buf) +{ + int i, + cpos; + + if (buf->firstLine == NULL) + return; + buf->cursorY = buf->currentLine->linenumber - buf->topLine->linenumber; + i = columnPos(buf->currentLine, buf->currentColumn + buf->visualpos); + cpos = COLPOS(buf->currentLine, i) - buf->currentColumn; + if (cpos >= 0) { + buf->cursorX = cpos; + buf->pos = i; + } + else if (Currentbuf->currentLine->len > i) { + buf->cursorX = 0; + buf->pos = i + 1; + } } void diff -urN w3m/main.c w3m-fix/main.c --- w3m/main.c Fri May 26 19:32:24 2000 +++ w3m-fix/main.c Fri May 26 19:32:29 2000 @@ -863,8 +851,6 @@ static void nscroll(int n) { - int pos, - col; Line *curtop = Currentbuf->topLine; int lnum, tlnum, @@ -884,11 +870,7 @@ if (lnum > llnum) lnum = llnum; gotoLine(Currentbuf, lnum); - pos = Currentbuf->visualpos; - col = columnPos(Currentbuf->currentLine, Currentbuf->currentColumn + pos); - Currentbuf->pos = MIN(col, Currentbuf->currentLine->len - 1); - arrangeCursor(Currentbuf); - Currentbuf->visualpos = pos; + arrangeLine(Currentbuf); displayBuffer(Currentbuf, B_SCROLL); } diff -urN w3m/proto.h w3m-fix/proto.h --- w3m/proto.h Fri May 26 19:32:24 2000 +++ w3m-fix/proto.h Fri May 26 19:32:29 2000 @@ -180,6 +180,7 @@ extern void cursorLeft(Buffer * buf); extern void cursorHome(Buffer * buf); extern void arrangeCursor(Buffer * buf); +extern void arrangeLine(Buffer * buf); extern void cursorXY(Buffer * buf, int x, int y); extern int arg_is(char *str, char *tag); extern int bpcmp(BufferPoint p1, BufferPoint p2);