Set the default for extended-keys back to off because it appears emacs turns

the keys on but does not correctly handle them except in xterm (!). Also fix so
that off takes effect as expected.
This commit is contained in:
nicm 2024-08-21 04:37:42 +00:00
parent c7e61a01e5
commit 4fa90c9acf
2 changed files with 31 additions and 8 deletions

26
input.c
View File

@ -1408,17 +1408,29 @@ input_csi_dispatch(struct input_ctx *ictx)
case INPUT_CSI_MODSET:
n = input_get(ictx, 0, 0, 0);
m = input_get(ictx, 1, 0, 0);
if (options_get_number(global_options, "extended-keys") == 2)
/*
* Set the extended key reporting mode as per the client request,
* unless "extended-keys always" forces us into mode 1.
*/
if (options_get_number(global_options, "extended-keys") != 1)
break;
if (n == 0 || (n == 4 && m == 0))
screen_write_mode_clear(sctx, MODE_KEXTENDED);
else if (n == 4 && (m == 1 || m == 2))
screen_write_mode_set(sctx, MODE_KEXTENDED);
screen_write_mode_clear(sctx,
MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2);
if (n == 4 && m == 1)
screen_write_mode_set(sctx, MODE_KEYS_EXTENDED);
if (n == 4 && m == 2)
screen_write_mode_set(sctx, MODE_KEYS_EXTENDED_2);
break;
case INPUT_CSI_MODOFF:
n = input_get(ictx, 0, 0, 0);
if (n == 4)
screen_write_mode_clear(sctx, MODE_KEXTENDED);
/*
* Clear the extended key reporting mode as per the client request,
* unless "extended-keys always" forces us into mode 1.
*/
if (n == 4) {
screen_write_mode_clear(sctx,
MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2);
}
break;
case INPUT_CSI_WINOPS:
input_csi_dispatch_winops(ictx);

View File

@ -94,6 +94,9 @@ static const char *options_table_detach_on_destroy_list[] = {
static const char *options_table_extended_keys_list[] = {
"off", "on", "always", NULL
};
static const char *options_table_extended_keys_format_list[] = {
"csi-u", "xterm", NULL
};
static const char *options_table_allow_passthrough_list[] = {
"off", "on", "all", NULL
};
@ -315,6 +318,14 @@ const struct options_table_entry options_table[] = {
"that support it."
},
{ .name = "extended-keys-format",
.type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_SERVER,
.choices = options_table_extended_keys_format_list,
.default_num = 1,
.text = "The format of emitted extended key sequences."
},
{ .name = "focus-events",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_SERVER,
@ -614,7 +625,7 @@ const struct options_table_entry options_table[] = {
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.scope = OPTIONS_TABLE_SESSION,
.default_num = '\002',
.default_num = 'b'|KEYC_CTRL,
.text = "The prefix key."
},