summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-04 23:50:34 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-04 23:50:34 +0800
commitd5b24eed395d4c949e05d675fcf3028cd21b8b4f (patch)
treed03bd72d629ea12184f7ccc0279693655d69f8f4 /mbbsd
parentf3b056046dab4ac2fc5d5a7d66226046fe3cee3b (diff)
downloadpttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar.gz
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar.bz2
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar.lz
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar.xz
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.tar.zst
pttbbs-d5b24eed395d4c949e05d675fcf3028cd21b8b4f.zip
pmore: fix line calculation
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2762 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/pmore.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index 16c89f7e..c168c304 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -1163,6 +1163,29 @@ pmore(char *fpath, int promptend)
int progress =
(int)((unsigned long)(mf.dispe-mf.start) * 100 / mf.len);
+ /*
+ * page determination is hard.
+ * should we use starting line, or finishing line?
+ */
+ int nowpage =
+ (int)((mf.lineno + mf.dispedlines/2) / MFNAV_PAGE)+1;
+ int allpages = -1; /* unknown yet */
+ if (mf.maxlinenoS >= 0)
+ {
+ allpages =
+ (int)((mf.maxlinenoS + mf.lastpagelines-1) / MFNAV_PAGE)+1;
+ if (mf.lineno >= mf.maxlinenoS || nowpage > allpages)
+ nowpage = allpages;
+ /*
+ nowpage =
+ (int)((mf.lineno + mf.dispedlines-2) / MFNAV_PAGE)+1 ;
+ */
+ }
+ /* why -2 and -1?
+ * because we want to determine by nav_page,
+ * and mf.dispedlines is based on disp_page (nav_page+1)
+ * mf.lastpagelines is based on nav_page
+ */
if(mf_viewedAll())
printcolor = ANSI_COLOR(37;44);
@@ -1178,7 +1201,7 @@ pmore(char *fpath, int promptend)
{
prints(" ÂsÄý P.%d(%d%%) %s %-30.30s%s",
- (int)(mf.lineno / MFNAV_PAGE)+1,
+ nowpage,
progress,
ANSI_COLOR(31;47),
"(h)"
@@ -1191,16 +1214,16 @@ pmore(char *fpath, int promptend)
} else {
- if(mf.maxlinenoS >= 0)
+ if(allpages >= 0)
sprintf(buf,
" ÂsÄý ²Ä %1d/%1d ­¶ ",
- (int)(mf.lineno / MFNAV_PAGE)+1,
- (int)(mf.maxlinenoS / MFNAV_PAGE)+1
+ nowpage,
+ allpages
);
else
sprintf(buf,
" ÂsÄý ²Ä %1d ­¶ ",
- (int)(mf.lineno / MFNAV_PAGE)+1
+ nowpage
);
outs(buf); prefixlen += strlen(buf);