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.
This commit is contained in:
Martin Lund 2016-05-08 11:39:34 +02:00
parent ece9e7f918
commit 755ac53553

View file

@ -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)