From 355d1dcde948b4226f1f11dfc45952aa6851a176 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 21 Dec 2007 12:34:15 +0000 Subject: - refresh screen after changing window size - fix getdata() clrtoeol issue git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3720 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/io.c | 1 + mbbsd/talk.c | 2 +- mbbsd/term.c | 24 ++++++++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'mbbsd') 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 -- cgit v1.2.3