diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | main.c | 23 |
2 files changed, 17 insertions, 13 deletions
@@ -1,3 +1,8 @@ +2003-01-31 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03712] buf fix of LINE_INFO + * main.c (curlno): rewrite + 2003-01-30 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03709] Re: view source, edit source @@ -6947,4 +6952,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.725 2003/01/29 17:38:12 ukai Exp $ +$Id: ChangeLog,v 1.726 2003/01/30 16:18:29 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.204 2003/01/29 17:38:15 ukai Exp $ */ +/* $Id: main.c,v 1.205 2003/01/30 16:18:31 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -4779,27 +4779,26 @@ curlno() { Line *l = Currentbuf->currentLine; Str tmp; - int cur = 0, all, col, len = 0; + int cur = 0, all = 0, col = 0, len = 0; if (l != NULL) { cur = l->real_linenumber; + col = l->bwidth + Currentbuf->currentColumn + Currentbuf->cursorX + 1; + while (l->next && l->next->bpos) + l = l->next; if (l->width < 0) l->width = COLPOS(l, l->len); len = l->bwidth + l->width; } - col = l->bwidth + Currentbuf->currentColumn + Currentbuf->cursorX + 1; - all = - (Currentbuf->lastLine ? Currentbuf->lastLine-> - real_linenumber : Currentbuf->allLine); - if (all == 0 && Currentbuf->lastLine != NULL) - all = l->real_linenumber; - if (all == 0) - all = 1; + if (Currentbuf->lastLine) + all = Currentbuf->lastLine->real_linenumber; if (Currentbuf->pagerSource && !(Currentbuf->bufferprop & BP_CLOSE)) tmp = Sprintf("line %d col %d/%d", cur, col, len); else - tmp = Sprintf("line %d/%d (%d%%) col %d/%d", - cur, all, cur * 100 / all, col, len); + tmp = Sprintf("line %d/%d (%d%%) col %d/%d", cur, all, + (int)((double)cur * 100.0 / (double)(all ? all : 1) + + 0.5), + col, len); #ifdef JP_CHARSET Strcat_charp(tmp, " "); Strcat_charp(tmp, code_to_str(Currentbuf->document_code)); |