Improve key command response for local echo and timestamp

This commit is contained in:
Martin Lund 2022-06-12 04:07:17 +02:00
parent 318bcbf650
commit 63d3232b32
2 changed files with 21 additions and 1 deletions

View file

@ -32,6 +32,7 @@ enum timestamp_t
TIMESTAMP_24HOUR,
TIMESTAMP_24HOUR_START,
TIMESTAMP_ISO8601,
TIMESTAMP_END,
};
const char* timestamp_token(enum timestamp_t timestamp);

View file

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