diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-03 21:09:47 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-03 21:09:47 +0800 |
commit | 6fc3f2e89c3378f44c8e863a96a3344799786569 (patch) | |
tree | bc2f5effe0b2d3a8d9b6beb2dd4a874d9cb8e43e | |
parent | a62dcffa2b2389caeb16f332e68cbcd5673bb5ca (diff) | |
download | pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar.gz pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar.bz2 pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar.lz pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar.xz pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.tar.zst pttbbs-6fc3f2e89c3378f44c8e863a96a3344799786569.zip |
pmore: formatting issues
talk.c: fixed more buffer bug.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2751 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/pmore.c | 34 | ||||
-rw-r--r-- | mbbsd/talk.c | 1 |
2 files changed, 23 insertions, 12 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 849b556e..7031bc88 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -33,7 +33,7 @@ * - Remember mmap pointers are NOT null terminated strings. * You have to use strn* APIs and make sure not exceeding mmap buffer. * DO NOT USE strcmp, strstr, strchr, ... - * - Scroll handling is painful. If you displaed anything on screen, + * - Scroll handling is painful. If you displayed anything on screen, * remember to MFDISP_DIRTY(); */ @@ -81,8 +81,10 @@ enum { #define MFDISP_PAGE (t_lines-1) // for display, the real number of lines to be shown. #define MFDISP_DIRTY() { mf.oldlineno = -1; } -#define RESETMF() { memset(&mf, 0, sizeof(mf)); mf.oldlineno = -1; } -#define RESETAH() { memset(&ah, 0, sizeof(ah)); } +#define RESETMF() { memset(&mf, 0, sizeof(mf)); \ + mf.oldlineno = -1; } +#define RESETAH() { memset(&ah, 0, sizeof(ah)); \ + ah.lines = ah.authorlen= ah.boardlen = -1; } #define ANSI_ESC (0x1b) @@ -344,9 +346,6 @@ void mf_parseHeader() * #define STR_POST2 "站內:" */ RESETAH(); - ah.lines = -1; - ah.authorlen= -1; - ah.boardlen = -1; if(mf.len > LEN_AUTHOR2) { if (strncmp(mf.start, STR_AUTHOR1, LEN_AUTHOR1) == 0) @@ -687,8 +686,9 @@ static const char * const pmore_help[] = { "(f/b) 跳至下/上篇", "(a/A) 跳至同一作者下/上篇", "(t/[-/]+) 主題式閱\讀 循序/上/下篇", + "(\\) 切換顯示原始內容", "(q)(←) 結束", - "(h)(H)(?) 輔助說明畫面", + "(h)(H)(?) 本說明畫面", #ifdef DEBUG "(d) 切換除錯(debug)模式", #endif @@ -745,9 +745,9 @@ int pmore(char *fpath, int promptend) else printcolor = "33;45"; - prints("\033[0;%sm", printcolor); + prints("\033[m\033[%sm", printcolor); sprintf(buf, - " 瀏覽 第 %1d 頁 \033[30;47m (%02d - %02d行,%3d%%) ", + " 瀏覽 第 %1d 頁 \033[1;30;47m (%02d - %02d行,%3d%%) ", (int)(mf.lineno / MFNAV_PAGE)+1, (int)(mf.lineno + 1), (int)(mf.lineno + MFDISP_PAGE), @@ -761,7 +761,7 @@ int pmore(char *fpath, int promptend) while(i-- > 0) outc(' '); if(i == -1) /* enough buffer */ - outs( "\033[31;47m(h)\033[30m按鍵說明 " + outs( "\033[0;31;47m(h)\033[30m按鍵說明 " "\033[31m←[q]\033[30m離開 "); outs("\033[m"); } @@ -924,7 +924,7 @@ int pmore(char *fpath, int promptend) getdata_buf(b_lines-1, 0, (pageMode ? "跳至此頁: " : "跳至此行: "), - buf, 5, DOECHO); + buf, 7, DOECHO); if(buf[0]) { i = atoi(buf); if(i-- > 0) @@ -937,7 +937,7 @@ int pmore(char *fpath, int promptend) case Ctrl('T'): { char buf[10]; - getdata(b_lines - 2, 0, "把這篇文章收入到暫存檔?[y/N] ", + getdata(b_lines - 1, 0, "把這篇文章收入到暫存檔?[y/N] ", buf, 4, LCECHO); if (buf[0] == 'y') { setuserfile(buf, ask_tmpbuf(b_lines - 1)); @@ -963,9 +963,19 @@ int pmore(char *fpath, int promptend) return 0; } break; + case '\\': + if (ah.lines >= 0) + { + RESETAH(); + } + else + mf_parseHeader(); + MFDISP_DIRTY(); + break; #ifdef DEBUG case 'd': debug = !debug; + MFDISP_DIRTY(); break; #endif } diff --git a/mbbsd/talk.c b/mbbsd/talk.c index f7721352..56f79d1a 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -950,6 +950,7 @@ t_display(void) setuserfile(genbuf, fn_writelog); if (more(genbuf, YEA) != -1) { move(b_lines - 4, 0); + clrtobot(); outs("\033[1;33;45m★現在 Ptt提供創新的水球整理程式★\033[m\n" "您將水球存至信箱後, 在【郵件選單】該信件前按 u,\n" "系統即會將您的水球紀錄重新整理後寄送給您唷! \n"); |