diff --git a/man/tio.1.in b/man/tio.1.in index 0576d0d..97ef873 100644 --- a/man/tio.1.in +++ b/man/tio.1.in @@ -417,7 +417,7 @@ Enable hexadecimal mode .IP "\fBsocket" Set socket to redirect I/O to .IP "\fBprefix-ctrl-key" -Set prefix ctrl key (a..z, default: t) +Set prefix ctrl key (a..z or 'none', default: t) .IP "\fBresponse-wait" Enable wait for line response .IP "\fBresponse-timeout" diff --git a/src/configfile.c b/src/configfile.c index 387063b..ef97f31 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -259,7 +259,11 @@ static int data_handler(void *user, const char *section, const char *name, } else if (!strcmp(name, "prefix-ctrl-key")) { - if (ctrl_key_code(value[0]) > 0) + if (!strcmp(value, "none")) + { + option.prefix_enabled = false; + } + else if (ctrl_key_code(value[0]) > 0) { option.prefix_code = ctrl_key_code(value[0]); option.prefix_key = value[0]; diff --git a/src/options.c b/src/options.c index 4f08e6d..8cfede9 100644 --- a/src/options.c +++ b/src/options.c @@ -86,6 +86,7 @@ struct option_t option = .hex_mode = false, .prefix_code = 20, // ctrl-t .prefix_key = 't', + .prefix_enabled = true, .response_wait = false, .response_timeout = 100, .mute = false, diff --git a/src/options.h b/src/options.h index b18d8ff..f1f2f73 100644 --- a/src/options.h +++ b/src/options.h @@ -59,6 +59,7 @@ struct option_t bool hex_mode; unsigned char prefix_code; unsigned char prefix_key; + bool prefix_enabled; bool response_wait; int response_timeout; bool mute; diff --git a/src/tty.c b/src/tty.c index e620f8f..abf79e9 100644 --- a/src/tty.c +++ b/src/tty.c @@ -339,7 +339,7 @@ void *tty_stdin_input_thread(void *arg) input_char = input_buffer[i]; - if (previous_char == option.prefix_code) + if (option.prefix_enabled && previous_char == option.prefix_code) { if (input_char == option.prefix_code) { @@ -569,7 +569,7 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward) } /* Handle escape key commands */ - if (previous_char == option.prefix_code) + if (option.prefix_enabled && previous_char == option.prefix_code) { /* Do not forward input char to output by default */ *forward = false; @@ -1545,7 +1545,7 @@ int tty_connect(void) if (interactive_mode) { /* Do not forward prefix key */ - if (input_char == option.prefix_code) + if (option.prefix_enabled && input_char == option.prefix_code) { forward = false; }