diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-26 18:17:57 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-26 18:17:57 +0000 |
commit | 91f74e09ec828e73037d094b3e4063601ebb7ce2 (patch) | |
tree | 20539d8e870b2525475e49402d0a56feaeb87125 /display.c | |
parent | [w3m-dev 02735] (diff) | |
download | w3m-91f74e09ec828e73037d094b3e4063601ebb7ce2.tar.gz w3m-91f74e09ec828e73037d094b3e4063601ebb7ce2.zip |
[w3m-dev 02748] cleanup code for restoring cursor position
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'display.c')
-rw-r--r-- | display.c | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.12 2001/12/04 16:33:08 ukai Exp $ */ +/* $Id: display.c,v 1.13 2001/12/26 18:17:57 ukai Exp $ */ #include <signal.h> #include "fm.h" @@ -188,8 +188,6 @@ static Linecolor color_mode = 0; static Buffer *save_current_buf = NULL; #endif -int in_check_url = FALSE; - char *delayed_msg = NULL; void @@ -198,8 +196,6 @@ displayBuffer(Buffer *buf, int mode) Str msg; Anchor *aa = NULL; - if (in_check_url) - return; if (buf->topLine == NULL && readBufferCache(buf) == 0) { /* clear_buffer */ mode = B_FORCE_REDRAW; } @@ -209,11 +205,8 @@ displayBuffer(Buffer *buf, int mode) if (buf->height == 0) buf->height = LASTLINE + 1; if (buf->width != INIT_BUFFER_WIDTH && buf->type - && !strcmp(buf->type, "text/html")) { - in_check_url = TRUE; + && !strcmp(buf->type, "text/html")) reshapeBuffer(buf); - in_check_url = FALSE; - } if (showLineNum) { if (buf->lastLine && buf->lastLine->real_linenumber > 0) buf->rootX = (int)(log(buf->lastLine->real_linenumber + 0.1) @@ -327,9 +320,9 @@ displayBuffer(Buffer *buf, int mode) standend(); refresh(); #ifdef USE_BUFINFO - if (Currentbuf != save_current_buf) { + if (buf != save_current_buf) { saveBufferInfo(); - save_current_buf = Currentbuf; + save_current_buf = buf; } #endif } @@ -1056,10 +1049,10 @@ arrangeLine(Buffer *buf) buf->cursorX = cpos; buf->pos = i; } - else if (Currentbuf->currentLine->len > i) { + else if (buf->currentLine->len > i) { int delta = 1; #ifdef JP_CHARSET - if (Currentbuf->currentLine->len > i + 1 && + if (buf->currentLine->len > i + 1 && CharType(buf->currentLine->propBuf[i + 1]) == PC_KANJI2) delta = 2; #endif @@ -1105,6 +1098,17 @@ cursorXY(Buffer *buf, int x, int y) } } +void +restorePosition(Buffer *buf, Buffer *orig) +{ + buf->topLine = lineSkip(buf, buf->firstLine, TOP_LINENUMBER(orig) - 1, + FALSE); + gotoLine(buf, CUR_LINENUMBER(orig)); + buf->pos = orig->pos; + buf->currentColumn = orig->currentColumn; + arrangeCursor(buf); +} + /* Local Variables: */ /* c-basic-offset: 4 */ /* tab-width: 8 */ |