Skip to content

Commit

Permalink
Ticket #1926: Ctrl-\ key behaviour in NCurses-based MC.
Browse files Browse the repository at this point in the history
Generally, Ctrl-\ is a default assignment to SIGQUIT signal.
S-Lang breaks this assignment. NCurses doesn't, therefore
MC just quits when user presses the Ctrl-\ key.

This commit emulates the S-Lang way in NCurses-based MC.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
  • Loading branch information
aborodin committed Feb 6, 2010
1 parent e23b0d5 commit 56bf77a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
11 changes: 11 additions & 0 deletions lib/tty/tty-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

#include "lib/global.h" /* include <glib.h> */

/* Taken from S-Lang's slutty.c */
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
# define NULL_VALUE -1
#else
# ifdef _POSIX_VDISABLE
# define NULL_VALUE _POSIX_VDISABLE
# else
# define NULL_VALUE 255
# endif
#endif

/* If true lines are shown by spaces */
extern gboolean slow_tty;

Expand Down
3 changes: 3 additions & 0 deletions lib/tty/tty-ncurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
/*** global variables **************************************************/

/*** file scope macro definitions **************************************/

#if defined(_AIX) && !defined(CTRL)
# define CTRL(x) ((x) & 0x1f)
#endif
Expand Down Expand Up @@ -158,6 +159,8 @@ tty_init (gboolean slow, gboolean ugly_lines)

/* use Ctrl-g to generate SIGINT */
cur_term->Nttyb.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);

tty_start_interrupt_key ();
Expand Down
13 changes: 1 addition & 12 deletions lib/tty/tty-slang.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,11 @@


/*** global variables **************************************************/

extern int reset_hp_softkeys;

/*** file scope macro definitions **************************************/

/* Taken from S-Lang's slutty.c */
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
# define NULL_VALUE -1
#else
# ifdef _POSIX_VDISABLE
# define NULL_VALUE _POSIX_VDISABLE
# else
# define NULL_VALUE 255
# endif
#endif /* ultrix */

#ifndef SA_RESTART
# define SA_RESTART 0
#endif
Expand All @@ -79,7 +69,6 @@ extern int reset_hp_softkeys;
#define SLTT_MAX_SCREEN_ROWS 512
#endif


/*** file scope type declarations **************************************/

/*** file scope variables **********************************************/
Expand Down

0 comments on commit 56bf77a

Please sign in to comment.