fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit 5d62ec75038954751f94c600c3987132ad1ff8ea parent e5a95c11d7532e5ad29c7b76b71e31a80a6208d4 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Sun, 19 Oct 2014 16:42:38 -0700 Disable signals from ^C (and friends) Allows us to interpret ^C through ^Z as control codes and handle them properly. Also fixes resetting termios after ^C Diffstat:
| M | fzy.c | | | 4 | ++++ |
| M | tty.c | | | 3 | ++- |
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git 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 @@ -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");