fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit fd86d68c889a3a37867b1e769eca2c0e17c0b24c parent 39d3bc8cfc4896ffb820da8549259e348c4bf72a Author: John Hawthorn <john.hawthorn@gmail.com> Date: Tue, 5 Apr 2016 15:30:19 -0700 Unset ICRNL on tty I get a few reports of enter not working with fzy occasionally. This usually occurrs after running a badly behaved program which doesn't clean up the tty properly (looking at you, pry) after cleaning the ICRNL flag. This commit now always unsets ICRNL. This also could have been fixed by ensuring ICRNL was set, but I believe this will give more control over keybindings. Diffstat:
| M | fzy.c | | | 2 | +- |
| M | tty.c | | | 8 | +++++--- |
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fzy.c b/fzy.c @@ -157,7 +157,7 @@ static void run(tty_t *tty, choices_t *choices) { clear(tty); tty_close(tty); exit(EXIT_FAILURE); - } else if (ch == 10) { /* Enter */ + } else if (ch == 13) { /* CR */ clear(tty); /* ttyout should be flushed before outputting on stdout */ diff --git a/tty.c b/tty.c @@ -30,11 +30,13 @@ void tty_init(tty_t *tty, const char *tty_filename) { struct termios new_termios = tty->original_termios; /* - * Disable both of + * Disable all of * ICANON Canonical input (erase and kill processing). - * ECHO Enable echo. - * ISIG Enable signals from control characters + * ECHO Echo. + * ISIG Signals from control characters + * ICRNL Conversion of CR characters into NL */ + new_termios.c_iflag &= ~(ICRNL); new_termios.c_lflag &= ~(ICANON | ECHO | ISIG); if (tcsetattr(tty->fdin, TCSANOW, &new_termios))