mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add support for disabling prefix key handling
To disable prefix key input handing simply set prefix-ctrl-key to 'none'. Based on original patch from Sebastian Krahmer.
This commit is contained in:
parent
6c520090c6
commit
593f9495f4
5 changed files with 11 additions and 5 deletions
|
|
@ -417,7 +417,7 @@ Enable hexadecimal mode
|
||||||
.IP "\fBsocket"
|
.IP "\fBsocket"
|
||||||
Set socket to redirect I/O to
|
Set socket to redirect I/O to
|
||||||
.IP "\fBprefix-ctrl-key"
|
.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"
|
.IP "\fBresponse-wait"
|
||||||
Enable wait for line response
|
Enable wait for line response
|
||||||
.IP "\fBresponse-timeout"
|
.IP "\fBresponse-timeout"
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,11 @@ static int data_handler(void *user, const char *section, const char *name,
|
||||||
}
|
}
|
||||||
else if (!strcmp(name, "prefix-ctrl-key"))
|
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_code = ctrl_key_code(value[0]);
|
||||||
option.prefix_key = value[0];
|
option.prefix_key = value[0];
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ struct option_t option =
|
||||||
.hex_mode = false,
|
.hex_mode = false,
|
||||||
.prefix_code = 20, // ctrl-t
|
.prefix_code = 20, // ctrl-t
|
||||||
.prefix_key = 't',
|
.prefix_key = 't',
|
||||||
|
.prefix_enabled = true,
|
||||||
.response_wait = false,
|
.response_wait = false,
|
||||||
.response_timeout = 100,
|
.response_timeout = 100,
|
||||||
.mute = false,
|
.mute = false,
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ struct option_t
|
||||||
bool hex_mode;
|
bool hex_mode;
|
||||||
unsigned char prefix_code;
|
unsigned char prefix_code;
|
||||||
unsigned char prefix_key;
|
unsigned char prefix_key;
|
||||||
|
bool prefix_enabled;
|
||||||
bool response_wait;
|
bool response_wait;
|
||||||
int response_timeout;
|
int response_timeout;
|
||||||
bool mute;
|
bool mute;
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ void *tty_stdin_input_thread(void *arg)
|
||||||
|
|
||||||
input_char = input_buffer[i];
|
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)
|
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 */
|
/* 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 */
|
/* Do not forward input char to output by default */
|
||||||
*forward = false;
|
*forward = false;
|
||||||
|
|
@ -1545,7 +1545,7 @@ int tty_connect(void)
|
||||||
if (interactive_mode)
|
if (interactive_mode)
|
||||||
{
|
{
|
||||||
/* Do not forward prefix key */
|
/* Do not forward prefix key */
|
||||||
if (input_char == option.prefix_code)
|
if (option.prefix_enabled && input_char == option.prefix_code)
|
||||||
{
|
{
|
||||||
forward = false;
|
forward = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue