aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-01-30 16:18:29 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-01-30 16:18:29 +0000
commit041c4b06e4cf4c344110b8e507a6cf470d208774 (patch)
treed4cdbddd0a0fb8d7562d3b2d03471ea1942a64d8
parent[w3m-dev 03709] Re: view source, edit source (diff)
downloadw3m-041c4b06e4cf4c344110b8e507a6cf470d208774.tar.gz
w3m-041c4b06e4cf4c344110b8e507a6cf470d208774.zip
[w3m-dev 03712] buf fix of LINE_INFO
* main.c (curlno): rewrite From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
-rw-r--r--ChangeLog7
-rw-r--r--main.c23
2 files changed, 17 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index ce856c8..74218a0 100644
--- 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
@@ -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 $
diff --git a/main.c b/main.c
index 219f907..6448a3b 100644
--- a/main.c
+++ b/main.c
@@ -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));