mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Changed quit key sequence to ctrl-g + q
Changed the quit key sequence from ctrl-g + ctrl-q to ctrl-g + q as the latter is simpler and considered more conventional.
This commit is contained in:
parent
a125dca499
commit
2cf211b99f
3 changed files with 8 additions and 8 deletions
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef TTY_H
|
||||
#define TTY_H
|
||||
|
||||
#define CTRLG 0x07
|
||||
#define CTRLQ 0x11
|
||||
#define KEY_CTRL_G 0x07
|
||||
#define KEY_Q 0x71
|
||||
|
||||
void configure_stdout(void);
|
||||
void restore_stdout(void);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void print_options_help(char *argv[])
|
|||
printf(" -v, --version Display version\n");
|
||||
printf(" -h, --help Display help\n");
|
||||
printf("\n");
|
||||
printf("In session, press ctrl-g + ctrl-q to quit.\n");
|
||||
printf("In session, press ctrl-g + q to quit.\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
10
src/tty.c
10
src/tty.c
|
|
@ -68,10 +68,10 @@ void wait_for_tty_device(void)
|
|||
/* Read one character */
|
||||
n = read(STDIN_FILENO, &c_stdin[0], 1);
|
||||
|
||||
/* Exit upon ctrl-g ctrl-q sequence */
|
||||
/* Exit upon ctrl-g + q sequence */
|
||||
c_stdin[2] = c_stdin[1];
|
||||
c_stdin[1] = c_stdin[0];
|
||||
if ((c_stdin[1] == CTRLQ) && (c_stdin[2] == CTRLG))
|
||||
if ((c_stdin[1] == KEY_Q) && (c_stdin[2] == KEY_CTRL_G))
|
||||
exit(EXIT_SUCCESS);
|
||||
} else
|
||||
{
|
||||
|
|
@ -222,13 +222,13 @@ int connect_tty(void)
|
|||
{
|
||||
/* Input from stdin ready */
|
||||
status = read(STDIN_FILENO, &c_stdin[0], 1);
|
||||
if ((c_stdin[0] != CTRLQ) && (c_stdin[0] != CTRLG))
|
||||
if ((c_stdin[0] != KEY_Q) && (c_stdin[0] != KEY_CTRL_G))
|
||||
tainted = true;
|
||||
|
||||
/* Exit upon ctrl-g ctrl-q sequence */
|
||||
/* Exit upon ctrl-g + q sequence */
|
||||
c_stdin[2] = c_stdin[1];
|
||||
c_stdin[1] = c_stdin[0];
|
||||
if ((c_stdin[1] == CTRLQ) && (c_stdin[2] == CTRLG))
|
||||
if ((c_stdin[1] == KEY_Q) && (c_stdin[2] == KEY_CTRL_G))
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
/* Forward input to tty device */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue