Merge branch '3697_ncurses_tty_init'

* 3697_ncurses_tty_init:
  Ticket #3697: (tty_init): unify curses initialization
This commit is contained in:
Andrew Borodin 2017-04-14 14:10:25 +03:00
commit e0d6617fd0

View File

@ -179,6 +179,8 @@ mc_tty_normalize_lines_char (const char *ch)
void
tty_init (gboolean mouse_enable, gboolean is_xterm)
{
struct termios mode;
initscr ();
#ifdef HAVE_ESCDELAY
@ -194,25 +196,15 @@ tty_init (gboolean mouse_enable, gboolean is_xterm)
ESCDELAY = 200;
#endif /* HAVE_ESCDELAY */
#ifdef NCURSES_VERSION
tcgetattr (STDIN_FILENO, &mode);
/* use Ctrl-g to generate SIGINT */
cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */
mode.c_cc[VINTR] = CTRL ('g'); /* ^g */
/* disable SIGQUIT to allow use Ctrl-\ key */
cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE;
tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb);
#else
/* other curses implementation (bsd curses, ...) */
{
struct termios mode;
mode.c_cc[VQUIT] = NULL_VALUE;
tcsetattr (STDIN_FILENO, TCSANOW, &mode);
tcgetattr (STDIN_FILENO, &mode);
/* use Ctrl-g to generate SIGINT */
mode.c_cc[VINTR] = CTRL ('g'); /* ^g */
/* disable SIGQUIT to allow use Ctrl-\ key */
mode.c_cc[VQUIT] = NULL_VALUE;
tcsetattr (STDIN_FILENO, TCSANOW, &mode);
}
#endif /* NCURSES_VERSION */
/* curses remembers the "in-program" modes after this call */
def_prog_mode ();
tty_start_interrupt_key ();