From 63d3232b32f7c8dc8af54a54878ee8e299a3657d Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sun, 12 Jun 2022 04:07:17 +0200 Subject: [PATCH] Improve key command response for local echo and timestamp --- src/options.h | 1 + src/tty.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/options.h b/src/options.h index e9942de..5684d33 100644 --- a/src/options.h +++ b/src/options.h @@ -32,6 +32,7 @@ enum timestamp_t TIMESTAMP_24HOUR, TIMESTAMP_24HOUR_START, TIMESTAMP_ISO8601, + TIMESTAMP_END, }; const char* timestamp_token(enum timestamp_t timestamp); diff --git a/src/tty.c b/src/tty.c index ebc7f80..3f3bbb3 100644 --- a/src/tty.c +++ b/src/tty.c @@ -227,6 +227,7 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c case KEY_E: option.local_echo = !option.local_echo; + tio_printf("Switched local echo %s", option.local_echo ? "on" : "off"); break; case KEY_H: @@ -269,7 +270,25 @@ void handle_command_sequence(char input_char, char previous_char, char *output_c break; case KEY_SHIFT_T: - option.timestamp = !option.timestamp; + option.timestamp += 1; + switch (option.timestamp) + { + case TIMESTAMP_NONE: + break; + case TIMESTAMP_24HOUR: + tio_printf("Switched to 24hour timestamp mode"); + break; + case TIMESTAMP_24HOUR_START: + tio_printf("Switched to 24hour-start timestamp mode"); + break; + case TIMESTAMP_ISO8601: + tio_printf("Switched to iso8601 timestamp mode"); + break; + case TIMESTAMP_END: + option.timestamp = TIMESTAMP_NONE; + tio_printf("Switched timestamp off"); + break; + } break; case KEY_V: