commit 7fc90f5a001b908efdfb77afd3e0c3a3f7a7aea8
parent 92c102b25e59054ea207df6034a69bf3edf0593c
Author: ukai <ukai>
Date: Thu, 30 Jan 2003 16:18:29 +0000
[w3m-dev 03712] buf fix of LINE_INFO
* main.c (curlno): rewrite
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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
diff --git a/main.c b/main.c
@@ -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));