diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-04 19:09:29 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-04 19:09:29 +0800 |
commit | 3928b7003a14e2ea05be30d64439b302d2b1f0c3 (patch) | |
tree | 3e3c41e0258e5f6bfdbccaf224fa2b4117573e37 | |
parent | 02720eba420f3977ed39b79245162e9b9a91529a (diff) | |
download | pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar.gz pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar.bz2 pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar.lz pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar.xz pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.tar.zst pttbbs-3928b7003a14e2ea05be30d64439b302d2b1f0c3.zip |
pmore: updates after applied on a real environment(ptt2) for a short time.
give wrapped lines a chance to use indicator's space to prevent wrapping.
and indicators can now be disabled
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2757 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/pmore.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 931aefe0..1ddaaae7 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -159,12 +159,15 @@ enum { /* browsing preference */ typedef struct { - int rawmode, // show file as-is. - wrapmode; // wrap? + /* mode flags */ + unsigned short int + rawmode, // show file as-is. + wrapmode, // wrap? + indicator; // show wrap indicators? } MF_BrowsingPrefrence; MF_BrowsingPrefrence bpref = -{ 0, MFDISP_WRAP_WRAP, }; +{ 0, MFDISP_WRAP_WRAP, 1, }; /* pretty format header */ #define FH_HEADERS (4) // how many headers do we know? @@ -910,7 +913,14 @@ mf_disp() } else #endif { - if(col <= maxcol) + /* if col > maxcol, + * because we have the space for + * "indicators" (one byte), + * so we can tolerate one more byte. + */ + if(col <= maxcol || + (mf.dispe < mf.end-1 && + *(mf.dispe+1) == '\n')) outc(*mf.dispe); else switch (bpref.wrapmode) { @@ -951,10 +961,13 @@ mf_disp() if(wrapping) endline = MFDISP_PAGE-1; - if(wrapping) - outs(MFDISP_WRAP_INDICATOR); - else - outs(MFDISP_TRUNC_INDICATOR); + if(bpref.indicator) + { + if(wrapping) + outs(MFDISP_WRAP_INDICATOR); + else + outs(MFDISP_TRUNC_INDICATOR); + } } else wrapping = 0; @@ -1010,7 +1023,7 @@ static const char * const pmore_help[] = { "(f/b) 跳至下/上篇", "(a/A) 跳至同一作者下/上篇", "(t/[-/]+) 主題式閱\讀:循序/前/後篇", - "(w/\\) 切換顯示原始內容/自動折行", // this IS already aligned! + "(\\/w/W) 切換顯示原始內容/自動折行/折行符號", // this IS already aligned! "(q)(←) 結束", "(h)(H)(?) 本說明畫面", #ifdef DEBUG @@ -1380,6 +1393,10 @@ pmore(char *fpath, int promptend) } MFDISP_DIRTY(); break; + case 'W': + bpref.indicator = !bpref.indicator; + MFDISP_DIRTY(); + break; case '\\': bpref.rawmode = !bpref.rawmode; MFDISP_DIRTY(); |