From b9a2f4a1beb2ea3c49e45f3082c0c2da2190eb64 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Thu, 2 Jun 2016 00:35:19 +0200 Subject: [PATCH] Added "ctrl-t c" key command to clear screen --- man/tio.1 | 2 ++ src/include/tio/tty.h | 1 + src/tty.c | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/man/tio.1 b/man/tio.1 index c71ae84..e5fe51e 100644 --- a/man/tio.1 +++ b/man/tio.1 @@ -70,6 +70,8 @@ Display help. In session, the following key sequences are intercepted as tio commands: .IP "\fBctrl-t ?" List available key commands +.IP "\fBctrl-t c" +Clear screen .IP "\fBctrl-t i" Show settings information (baudrate, databits, etc.) .IP "\fBctrl-t q" diff --git a/src/include/tio/tty.h b/src/include/tio/tty.h index f0339a0..4438199 100644 --- a/src/include/tio/tty.h +++ b/src/include/tio/tty.h @@ -23,6 +23,7 @@ #define TTY_H #define KEY_QUESTION 0x3f +#define KEY_C 0x63 #define KEY_I 0x69 #define KEY_Q 0x71 #define KEY_S 0x73 diff --git a/src/tty.c b/src/tty.c index fccd5ff..e9354f4 100644 --- a/src/tty.c +++ b/src/tty.c @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include #include @@ -63,6 +64,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c { char unused_char; bool unused_bool; + int __attribute__((unused)) status; /* Ignore unused arguments */ if (output_char == NULL) @@ -79,12 +81,17 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c case KEY_QUESTION: tio_printf("Key commands:"); tio_printf(" ctrl-t ? List available key commands"); + tio_printf(" ctrl-t c Clear screen"); tio_printf(" ctrl-t i Show settings information"); tio_printf(" ctrl-t q Quit"); tio_printf(" ctrl-t s Show statistics"); tio_printf(" ctrl-t t Send ctrl-t key code"); *forward = false; break; + case KEY_C: + status = system("clear"); + *forward = false; + break; case KEY_I: tio_printf("Settings information:"); tio_printf(" TTY device: %s", option.tty_device);