summaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2016-04-05 15:30:19 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2016-04-05 15:52:17 -0700
commit24f8bcc162ad68cd24f49b9bf80f3396aa97255f (patch)
tree1335c796814178b40c68c730cda05cdd68cdc7bd /tty.c
parent8d94b43ef7d04225b9104ea286d88cc09d873919 (diff)
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 (limited to 'tty.c')
-rw-r--r--tty.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tty.c b/tty.c
index 5293627..11c6de4 100644
--- 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))