diff --git a/src/fe-text/term-curses.c b/src/fe-text/term-curses.c index 02ac826b..e3b8e87b 100644 --- a/src/fe-text/term-curses.c +++ b/src/fe-text/term-curses.c @@ -83,7 +83,7 @@ static int init_curses(void) #ifdef VSUSP tio.c_cc[VSUSP] = _POSIX_VDISABLE; #endif - tcsetattr(0, 0, &tio); + tcsetattr(0, TCSADRAIN, &tio); } if (has_colors()) @@ -131,7 +131,7 @@ static int term_init_int(void) static void term_deinit_int(void) { - tcsetattr(0, 0, &old_tio); + tcsetattr(0, TCSADRAIN, &old_tio); endwin(); g_free_and_null(root_window); diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 3dee2ffc..ad1e9253 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -364,7 +364,7 @@ static void terminfo_colors_deinit(TERM_REC *term) { int i; - if (terminfo_has_colors(term)) { + if (terminfo_is_colors_set(term)) { for (i = 0; i < 16; i++) { g_free(term->TI_fg[i]); g_free(term->TI_bg[i]); @@ -383,7 +383,8 @@ void terminfo_setup_colors(TERM_REC *term, int force) const char *bold, *blink; int i; - terminfo_colors_deinit(term); + terminfo_colors_deinit(term); + term->has_colors = term->TI_setf || term->TI_setaf; if (term->TI_setf) { for (i = 0; i < 8; i++) @@ -444,13 +445,13 @@ static void terminfo_input_init(TERM_REC *term) term->tio.c_cc[VSUSP] = _POSIX_VDISABLE; #endif - tcsetattr(fileno(term->in), 0, &term->tio); + tcsetattr(fileno(term->in), TCSADRAIN, &term->tio); } static void terminfo_input_deinit(TERM_REC *term) { - tcsetattr(fileno(term->in), 0, &term->old_tio); + tcsetattr(fileno(term->in), TCSADRAIN, &term->old_tio); } void terminfo_cont(TERM_REC *term)