summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fzy.c4
-rw-r--r--tty.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/fzy.c b/fzy.c
index 7663b71..dbefa45 100644
--- a/fzy.c
+++ b/fzy.c
@@ -153,6 +153,10 @@ void run(tty_t *tty, choices_t *choices){
strncpy(search, choices_get(choices, choices->selection), SEARCH_SIZE_MAX);
search_size = strlen(search);
choices_search(choices, search);
+ }else if(ch == 3 || ch == 4){ /* ^C || ^D */
+ clear(tty);
+ tty_close(tty);
+ exit(EXIT_FAILURE);
}else if(ch == 10){ /* Enter */
clear(tty);
diff --git a/tty.c b/tty.c
index 6939eb9..31fa095 100644
--- a/tty.c
+++ b/tty.c
@@ -33,8 +33,9 @@ void tty_init(tty_t *tty, const char *tty_filename){
* Disable both of
* ICANON Canonical input (erase and kill processing).
* ECHO Enable echo.
+ * ISIG Disable signals from control characters
*/
- new_termios.c_lflag &= ~(ICANON | ECHO);
+ new_termios.c_lflag &= ~(ICANON | ECHO | ISIG);
if(tcsetattr(tty->fdin, TCSANOW, &new_termios))
perror("tcsetattr");