summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mbbsd/io.c1
-rw-r--r--mbbsd/talk.c2
-rw-r--r--mbbsd/term.c24
3 files changed, 22 insertions, 5 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 6916322a..17eb837b 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -700,6 +700,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
// workaround poor terminal
move_ansi(line, col);
getyx(&line, &col);
+ clrtoeol();
// (line, col) are real starting address
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index e431f43a..c19768b0 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -3092,7 +3092,7 @@ t_idle(void)
currutmp->destuid = idle_type;
do {
move(b_lines - 2, 0);
- clrtoeol();
+ clrtobot();
prints("(鎖定螢幕)發呆原因: %s", (idle_type != 6) ?
IdleTypeTable[idle_type] : idle_reason);
refresh();
diff --git a/mbbsd/term.c b/mbbsd/term.c
index bea4ec33..c1f5efd8 100644
--- a/mbbsd/term.c
+++ b/mbbsd/term.c
@@ -40,22 +40,38 @@ sig_term_resize(int sig)
void term_resize(int w, int h)
{
+ char changed = 0;
+ screen_backup_t scr;
+
Signal(SIGWINCH, SIG_IGN); /* Don't bother me! */
+
/* make sure reasonable size */
h = MAX(24, MIN(100, h));
w = MAX(80, MIN(200, w));
- // invoke terminal system resize
- resizeterm(h, w);
+ if (w != t_columns || h != t_lines)
+ {
+ scr_dump(&scr);
+ changed = 1;
+
+ // invoke terminal system resize
+ resizeterm(h, w);
- t_lines = h;
- t_columns = w;
+ t_lines = h;
+ t_columns = w;
+ }
scr_lns = t_lines; /* XXX: scr_lns 跟 t_lines 有什麼不同, 為何分成兩個 */
b_lines = t_lines - 1;
p_lines = t_lines - 4;
Signal(SIGWINCH, sig_term_resize);
+
+ if (changed)
+ {
+ scr_restore(&scr);
+ redrawwin();
+ }
}
int