version 1.36, 2011/03/03 08:53:14 |
version 1.37, 2011/03/07 23:46:27 |
|
|
* |
* |
* - A state for the screen \033k...\033\\ sequence to rename a window. This is |
* - A state for the screen \033k...\033\\ sequence to rename a window. This is |
* pretty stupid but not supporting it is more trouble than it is worth. |
* pretty stupid but not supporting it is more trouble than it is worth. |
|
* |
|
* - Special handling for ESC inside a DCS to allow arbitrary byte sequences to |
|
* be passed to the underlying teminal(s). |
*/ |
*/ |
|
|
/* Helper functions. */ |
/* Helper functions. */ |
|
|
|
|
/* Transition entry/exit handlers. */ |
/* Transition entry/exit handlers. */ |
void input_clear(struct input_ctx *); |
void input_clear(struct input_ctx *); |
void input_enter_dcs(struct input_ctx *); |
|
void input_exit_dcs(struct input_ctx *); |
|
void input_enter_osc(struct input_ctx *); |
void input_enter_osc(struct input_ctx *); |
void input_exit_osc(struct input_ctx *); |
void input_exit_osc(struct input_ctx *); |
void input_enter_apc(struct input_ctx *); |
void input_enter_apc(struct input_ctx *); |
|
|
int input_esc_dispatch(struct input_ctx *); |
int input_esc_dispatch(struct input_ctx *); |
int input_csi_dispatch(struct input_ctx *); |
int input_csi_dispatch(struct input_ctx *); |
void input_csi_dispatch_sgr(struct input_ctx *); |
void input_csi_dispatch_sgr(struct input_ctx *); |
|
int input_dcs_dispatch(struct input_ctx *); |
int input_utf8_open(struct input_ctx *); |
int input_utf8_open(struct input_ctx *); |
int input_utf8_add(struct input_ctx *); |
int input_utf8_add(struct input_ctx *); |
int input_utf8_close(struct input_ctx *); |
int input_utf8_close(struct input_ctx *); |
|
|
const struct input_transition input_state_dcs_parameter_table[]; |
const struct input_transition input_state_dcs_parameter_table[]; |
const struct input_transition input_state_dcs_intermediate_table[]; |
const struct input_transition input_state_dcs_intermediate_table[]; |
const struct input_transition input_state_dcs_handler_table[]; |
const struct input_transition input_state_dcs_handler_table[]; |
|
const struct input_transition input_state_dcs_escape_table[]; |
const struct input_transition input_state_dcs_ignore_table[]; |
const struct input_transition input_state_dcs_ignore_table[]; |
const struct input_transition input_state_osc_string_table[]; |
const struct input_transition input_state_osc_string_table[]; |
const struct input_transition input_state_apc_string_table[]; |
const struct input_transition input_state_apc_string_table[]; |
|
|
/* dcs_handler state definition. */ |
/* dcs_handler state definition. */ |
const struct input_state input_state_dcs_handler = { |
const struct input_state input_state_dcs_handler = { |
"dcs_handler", |
"dcs_handler", |
input_enter_dcs, input_exit_dcs, |
NULL, NULL, |
input_state_dcs_handler_table |
input_state_dcs_handler_table |
}; |
}; |
|
|
|
/* dcs_escape state definition. */ |
|
const struct input_state input_state_dcs_escape = { |
|
"dcs_escape", |
|
NULL, NULL, |
|
input_state_dcs_escape_table |
|
}; |
|
|
/* dcs_ignore state definition. */ |
/* dcs_ignore state definition. */ |
const struct input_state input_state_dcs_ignore = { |
const struct input_state input_state_dcs_ignore = { |
"dcs_ignore", |
"dcs_ignore", |
|
|
{ 0x3a, 0x3a, NULL, &input_state_dcs_ignore }, |
{ 0x3a, 0x3a, NULL, &input_state_dcs_ignore }, |
{ 0x3b, 0x3b, input_parameter, &input_state_dcs_parameter }, |
{ 0x3b, 0x3b, input_parameter, &input_state_dcs_parameter }, |
{ 0x3c, 0x3f, input_intermediate, &input_state_dcs_parameter }, |
{ 0x3c, 0x3f, input_intermediate, &input_state_dcs_parameter }, |
{ 0x40, 0x7e, NULL, &input_state_dcs_handler }, |
{ 0x40, 0x7e, input_input, &input_state_dcs_handler }, |
{ 0x7f, 0xff, NULL, NULL }, |
{ 0x7f, 0xff, NULL, NULL }, |
|
|
{ -1, -1, NULL, NULL } |
{ -1, -1, NULL, NULL } |
|
|
{ 0x3a, 0x3a, NULL, &input_state_dcs_ignore }, |
{ 0x3a, 0x3a, NULL, &input_state_dcs_ignore }, |
{ 0x3b, 0x3b, input_parameter, NULL }, |
{ 0x3b, 0x3b, input_parameter, NULL }, |
{ 0x3c, 0x3f, NULL, &input_state_dcs_ignore }, |
{ 0x3c, 0x3f, NULL, &input_state_dcs_ignore }, |
{ 0x40, 0x7e, NULL, &input_state_dcs_handler }, |
{ 0x40, 0x7e, input_input, &input_state_dcs_handler }, |
{ 0x7f, 0xff, NULL, NULL }, |
{ 0x7f, 0xff, NULL, NULL }, |
|
|
{ -1, -1, NULL, NULL } |
{ -1, -1, NULL, NULL } |
|
|
{ 0x1c, 0x1f, NULL, NULL }, |
{ 0x1c, 0x1f, NULL, NULL }, |
{ 0x20, 0x2f, input_intermediate, NULL }, |
{ 0x20, 0x2f, input_intermediate, NULL }, |
{ 0x30, 0x3f, NULL, &input_state_dcs_ignore }, |
{ 0x30, 0x3f, NULL, &input_state_dcs_ignore }, |
{ 0x40, 0x7e, NULL, &input_state_dcs_handler }, |
{ 0x40, 0x7e, input_input, &input_state_dcs_handler }, |
{ 0x7f, 0xff, NULL, NULL }, |
{ 0x7f, 0xff, NULL, NULL }, |
|
|
{ -1, -1, NULL, NULL } |
{ -1, -1, NULL, NULL } |
|
|
|
|
/* dcs_handler state table. */ |
/* dcs_handler state table. */ |
const struct input_transition input_state_dcs_handler_table[] = { |
const struct input_transition input_state_dcs_handler_table[] = { |
INPUT_STATE_ANYWHERE, |
/* No INPUT_STATE_ANYWHERE */ |
|
|
{ 0x00, 0x17, NULL, NULL }, |
{ 0x00, 0x1a, input_input, NULL }, |
{ 0x19, 0x19, input_input, NULL }, |
{ 0x1b, 0x1b, NULL, &input_state_dcs_escape }, |
{ 0x1c, 0x1f, input_input, NULL }, |
{ 0x1c, 0xff, input_input, NULL }, |
{ 0x20, 0x7e, input_input, NULL }, |
|
{ 0x7f, 0xff, NULL, NULL }, |
|
|
|
{ -1, -1, NULL, NULL } |
{ -1, -1, NULL, NULL } |
}; |
}; |
|
|
|
/* dcs_escape state table. */ |
|
const struct input_transition input_state_dcs_escape_table[] = { |
|
/* No INPUT_STATE_ANYWHERE */ |
|
|
|
{ 0x00, 0x5b, input_input, &input_state_dcs_handler }, |
|
{ 0x5c, 0x5c, input_dcs_dispatch, &input_state_ground }, |
|
{ 0x5d, 0xff, input_input, &input_state_dcs_handler }, |
|
|
|
{ -1, -1, NULL, NULL } |
|
}; |
|
|
/* device_ignore state table. */ |
/* device_ignore state table. */ |
const struct input_transition input_state_dcs_ignore_table[] = { |
const struct input_transition input_state_dcs_ignore_table[] = { |
INPUT_STATE_ANYWHERE, |
INPUT_STATE_ANYWHERE, |
|
|
} |
} |
} |
} |
|
|
/* DCS string started. */ |
/* DCS terminator (ST) received. */ |
void |
int |
input_enter_dcs(struct input_ctx *ictx) |
input_dcs_dispatch(struct input_ctx *ictx) |
{ |
{ |
log_debug("%s", __func__); |
const char prefix[] = "tmux;"; |
|
const u_int prefix_len = (sizeof prefix) - 1; |
|
|
input_clear(ictx); |
if (ictx->flags & INPUT_DISCARD) |
} |
return (0); |
|
|
/* DCS terminator (ST) received. */ |
log_debug("%s: \"%s\"", __func__, ictx->input_buf); |
void |
|
input_exit_dcs(unused struct input_ctx *ictx) |
/* Check for tmux prefix. */ |
{ |
if (ictx->input_len >= prefix_len && |
log_debug("%s", __func__); |
strncmp(ictx->input_buf, prefix, prefix_len) == 0) { |
|
screen_write_rawstring(&ictx->ctx, |
|
ictx->input_buf + prefix_len, ictx->input_len - prefix_len); |
|
} |
|
|
|
return (0); |
} |
} |
|
|
/* OSC string started. */ |
/* OSC string started. */ |