From 755ac53553826b0588e1cb90f63ffca282916460 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sun, 8 May 2016 11:39:34 +0200 Subject: [PATCH] Fixed handling of ctrl-t Before, when exercising the quit key sequence (ctrl-t + q) the ctrl-t code (0x14) would be sent. This is now fixed so that it is not sent. However, in case it is needed to send ctrl-t to the device it is possible by simply repeating the ctrl-t. Meaning, ctrl-t + ctrl-t = ctrl-t sent to device. --- src/tty.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tty.c b/src/tty.c index d8cacea..bf54335 100644 --- a/src/tty.c +++ b/src/tty.c @@ -253,10 +253,15 @@ int connect_tty(void) if ((c_stdin[1] == KEY_Q) && (c_stdin[2] == KEY_CTRL_T)) exit(EXIT_SUCCESS); - /* Forward input to tty device */ - status = write(fd, &c_stdin[0], 1); - if (status < 0) - printf("Warning: Could not write to tty device"); + /* Ignore ctrl-t except when repeated */ + if ((c_stdin[0] != KEY_CTRL_T) || + ((c_stdin[0] == KEY_CTRL_T) && (c_stdin[1] == KEY_CTRL_T))) + { + /* Forward input to tty device */ + status = write(fd, &c_stdin[0], 1); + if (status < 0) + printf("Warning: Could not write to tty device"); + } /* Write to log */ if (option.log)