summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/common.h6
-rw-r--r--include/proto.h4
-rw-r--r--mbbsd/bbs.c6
-rw-r--r--mbbsd/board.c2
-rw-r--r--mbbsd/edit.c19
-rw-r--r--mbbsd/pmore.c23
-rw-r--r--mbbsd/screen.c20
-rw-r--r--mbbsd/talk.c2
-rw-r--r--mbbsd/user.c2
9 files changed, 36 insertions, 48 deletions
diff --git a/include/common.h b/include/common.h
index dcdfb8ad..b4f47ecc 100644
--- a/include/common.h
+++ b/include/common.h
@@ -241,6 +241,12 @@
#define EDITFLAG_TEXTONLY (0x00000001)
#define EDITFLAG_UPLOAD (0x00000002)
+/* ----------------------------------------------------- */
+/* Grayout Levels */
+/* ----------------------------------------------------- */
+#define GRAYOUT_BOLD (-1)
+#define GRAYOUT_DARK (0)
+#define GRAYOUT_NORM (1)
/* ----------------------------------------------------- */
/* Macros */
diff --git a/include/proto.h b/include/proto.h
index 849a8d42..b56690cf 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -581,8 +581,8 @@ void rscroll(void);
void region_scroll_up(int top, int bottom);
void screen_backup(screen_backup_t *buf);
void screen_restore(const screen_backup_t *buf);
-#define HAVE_SCREEN_GRAYOUT
-void grayout_lines(int start, int end, int level);
+#define HAVE_GRAYOUT
+void grayout(int start, int end, int level);
/* stuff */
#define isprint2(ch) ((ch & 0x80) || isprint(ch))
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 0baf6de9..d0a722f5 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1385,7 +1385,7 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
local_article = fhdr->filemode & FILE_LOCAL;
// copying takes long time, add some visual effect
- grayout_lines(0, b_lines-1, 0);
+ grayout(0, b_lines-2, GRAYOUT_DARK);
move(b_lines-1, 0); clrtoeol();
outs("正在載入檔案...");
refresh();
@@ -3132,8 +3132,8 @@ view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, int crs_ln
if(fhdr->filename[0] == '.')
return DONOTHING;
- grayout_lines(0, MIN(l - 1, area_l), 0);
- grayout_lines(MAX(l + 1 + 1, area_l + area_lines), b_lines, 0);
+ grayout(0, MIN(l - 1, area_l)-1, GRAYOUT_DARK);
+ grayout(MAX(l + 1 + 1, area_l + area_lines), b_lines-1, GRAYOUT_DARK);
/* 清除文章的前一行或後一行 */
if(area_l > l)
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 3febb2e7..66402831 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -286,7 +286,7 @@ b_config(void)
ytitle ++;
#endif // OLDRECOMMEND
- grayout_lines(0, ytitle-1, 0);
+ grayout(0, ytitle-2, GRAYOUT_DARK);
// available hotkeys yet:
// a b d j k m p q z
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 813bda39..35933b59 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -705,22 +705,6 @@ delete_line(textline_t * line, int saved)
}
}
-static int
-ask(const char *prompt)
-{
- int ch;
-
- move(0, 0);
- clrtoeol();
- standout();
- outs(prompt);
- standend();
- ch = igetch();
- move(0, 0);
- clrtoeol();
- return (ch);
-}
-
/**
* Return the indent space number according to CURRENT line and the FORMER
* line. It'll be the first line contains non-space character.
@@ -3060,7 +3044,8 @@ vedit2(char *fpath, int saveheader, int *islocal, int flags)
curr_buf->oldcurrline = curr_buf->currline;
break;
case Ctrl('Q'): /* Quit without saving */
- ch = ask("結束但不儲存 (Y/N)? [N]: ");
+ grayout(0, b_lines-1, GRAYOUT_DARK);
+ ch = vmsg("結束但不儲存 [y/N]? ");
if (ch == 'y' || ch == 'Y') {
currutmp->mode = mode0;
currutmp->destuid = destuid0;
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index 06fecc05..8275290c 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -67,9 +67,12 @@
#define PMORE_LOG_SYSOP_EDIT // log whenever sysop uses E
#define PMORE_OVERRIDE_TIME // override time format if possible
-#ifndef EXP_PFTERM // pfterm is a good terminal system.
+// if you are working with a terminal without ANSI control,
+// you are using a poor term (define PMORE_USING_POOR_TERM).
+#ifndef HAVE_PFTERM // pfterm is a good terminal system.
+#define PMORE_USING_POOR_TERM
#define PMORE_WORKAROUND_CLRTOEOL // try to work with poor terminal sys
-#endif // EXP_PFTERM
+#endif // HAVE_PFTERM
// -------------------------------------------------------------- </FEATURES>
// ----------------------------------------------------------- <LOCALIZATION>
@@ -1049,14 +1052,14 @@ mf_display()
#ifdef PMORE_USE_OPT_SCROLL
-#if defined(PMORE_USE_ASCII_MOVIE) && !defined(PMORE_WORKAROUND_CLRTOEOL)
+#if defined(PMORE_USE_ASCII_MOVIE) && !defined(PMORE_USING_POOR_TERM)
// For movies, maybe clear() is better.
// Let's enable for good terminals (which does not need workarounds)
if (mfmovie.mode == MFDISP_MOVIE_PLAYING)
{
clear(); move(0, 0);
} else
-#endif // PMORE_USE_ASCII_MOVIE && (!PMORE_WORKAROUND_CLRTOEOL)
+#endif // PMORE_USE_ASCII_MOVIE && (!PMORE_USING_POOR_TERM)
/* process scrolling */
if (mf.oldlineno >= 0 && mf.oldlineno != mf.lineno)
@@ -2515,9 +2518,9 @@ pmore_QuickRawModePref()
{
int ystart = b_lines -2;
-#ifdef HAVE_SCREEN_GRAYOUT
- grayout_lines(0, ystart, 0);
-#endif // HAVE_SCREEN_GRAYOUT
+#ifdef HAVE_GRAYOUT
+ grayout(0, ystart-1, GRAYOUT_DARK);
+#endif // HAVE_GRAYOUT
while(1)
{
@@ -2563,9 +2566,9 @@ pmore_Preference()
// TODO even better pref navigation, like arrow keys
// static int lastkey = '\\'; // default key
-#ifdef HAVE_SCREEN_GRAYOUT
- grayout_lines(0, ystart, 0);
-#endif // HAVE_SCREEN_GRAYOUT
+#ifdef HAVE_GRAYOUT
+ grayout(0, ystart-1, GRAYOUT_DARK);
+#endif // HAVE_GRAYOUT
while (1)
{
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index fa10e985..03f825c1 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -1,7 +1,7 @@
/* $Id$ */
#include "bbs.h"
-#ifndef EXP_PFTERM
+#if !defined(EXP_PFTERM) && !defined(HAVE_PFTERM)
#define o_clear() output(clearbuf,clearbuflen)
#define o_cleol() output(cleolbuf,cleolbuflen)
@@ -523,7 +523,7 @@ standend(void)
// 1 - text
// 2 - no highlight (not implemented)
void
-grayout_lines(int y, int end, int level)
+grayout(int y, int end, int level)
{
register screenline_t *slp = NULL;
char buf[ANSILINELEN];
@@ -534,7 +534,7 @@ grayout_lines(int y, int end, int level)
// TODO change to y <= end someday
// loop lines
- for (; y < end; y ++)
+ for (; y <= end; y ++)
{
// modify by scroll
i = y + roll;
@@ -571,8 +571,8 @@ grayout_lines(int y, int end, int level)
switch(level)
{
- case 0: // dark text
- case -1:// bold text
+ case GRAYOUT_DARK: // dark text
+ case GRAYOUT_BOLD:// bold text
// basically, in current system slp->data will
// not exceed t_columns. buffer overflow is impossible.
// but to make it more robust, let's quick check here.
@@ -586,7 +586,7 @@ grayout_lines(int y, int end, int level)
slp->len = strlen((char*)slp->data);
break;
- case 1: // Plain text
+ case GRAYOUT_NORM: // Plain text
memcpy(slp->data, buf, slp->len + 1);
break;
}
@@ -594,12 +594,6 @@ grayout_lines(int y, int end, int level)
}
}
-void grayout_line(int y, int level)
-{
- return grayout_lines(y, y+1, level);
-}
-
-
static size_t screen_backupsize(int len, const screenline_t *bp)
{
int i;
@@ -656,7 +650,7 @@ void screen_restore(const screen_backup_t *old)
redoscr();
}
-#endif
+#endif // !defined(EXP_PFTERM) && !defined(HAVE_PFTERM)
/* vim:sw=4
*/
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 5a82e5bb..b3b5a4c2 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1081,7 +1081,7 @@ t_display(void)
}
setuserfile(genbuf, fn_writelog);
if (more(genbuf, YEA) != -1) {
- grayout_lines(0, b_lines-4, 0);
+ grayout(0, b_lines-5, GRAYOUT_DARK);
move(b_lines - 4, 0);
clrtobot();
outs(ANSI_COLOR(1;33;45) "★水球整理程式 " ANSI_RESET "\n"
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 0b912c05..92c423f2 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -502,7 +502,7 @@ void Customize(void)
}
- grayout_lines(1, b_lines, 0);
+ grayout(1, b_lines-2, GRAYOUT_DARK);
move(b_lines-1, 0); clrtoeol();
if(dirty)