Added "ctrl-t c" key command to clear screen

This commit is contained in:
Martin Lund 2016-06-02 00:35:19 +02:00
parent e9db9ea0de
commit b9a2f4a1be
3 changed files with 10 additions and 0 deletions

View file

@ -70,6 +70,8 @@ Display help.
In session, the following key sequences are intercepted as tio commands: In session, the following key sequences are intercepted as tio commands:
.IP "\fBctrl-t ?" .IP "\fBctrl-t ?"
List available key commands List available key commands
.IP "\fBctrl-t c"
Clear screen
.IP "\fBctrl-t i" .IP "\fBctrl-t i"
Show settings information (baudrate, databits, etc.) Show settings information (baudrate, databits, etc.)
.IP "\fBctrl-t q" .IP "\fBctrl-t q"

View file

@ -23,6 +23,7 @@
#define TTY_H #define TTY_H
#define KEY_QUESTION 0x3f #define KEY_QUESTION 0x3f
#define KEY_C 0x63
#define KEY_I 0x69 #define KEY_I 0x69
#define KEY_Q 0x71 #define KEY_Q 0x71
#define KEY_S 0x73 #define KEY_S 0x73

View file

@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -63,6 +64,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
{ {
char unused_char; char unused_char;
bool unused_bool; bool unused_bool;
int __attribute__((unused)) status;
/* Ignore unused arguments */ /* Ignore unused arguments */
if (output_char == NULL) if (output_char == NULL)
@ -79,12 +81,17 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c
case KEY_QUESTION: case KEY_QUESTION:
tio_printf("Key commands:"); tio_printf("Key commands:");
tio_printf(" ctrl-t ? List available 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 i Show settings information");
tio_printf(" ctrl-t q Quit"); tio_printf(" ctrl-t q Quit");
tio_printf(" ctrl-t s Show statistics"); tio_printf(" ctrl-t s Show statistics");
tio_printf(" ctrl-t t Send ctrl-t key code"); tio_printf(" ctrl-t t Send ctrl-t key code");
*forward = false; *forward = false;
break; break;
case KEY_C:
status = system("clear");
*forward = false;
break;
case KEY_I: case KEY_I:
tio_printf("Settings information:"); tio_printf("Settings information:");
tio_printf(" TTY device: %s", option.tty_device); tio_printf(" TTY device: %s", option.tty_device);