kf* terminfo capabilities are poorly defined and rxvt uses them in a

different way from xterm, so add a feature flag for rxvt to make tmux
ignore the capabilities and instead rely on its builtin definitions.
This commit is contained in:
nicm 2022-06-14 07:29:00 +00:00
parent 42ddf02ffc
commit 616bde08ac
4 changed files with 111 additions and 36 deletions

View File

@ -363,7 +363,8 @@ const struct options_table_entry options_table[] = {
.scope = OPTIONS_TABLE_SERVER, .scope = OPTIONS_TABLE_SERVER,
.flags = OPTIONS_TABLE_IS_ARRAY, .flags = OPTIONS_TABLE_IS_ARRAY,
.default_str = "xterm*:clipboard:ccolour:cstyle:focus:title," .default_str = "xterm*:clipboard:ccolour:cstyle:focus:title,"
"screen*:title", "screen*:title,"
"rxvt*:ignorefkeys",
.separator = ",", .separator = ",",
.text = "List of terminal features, used if they cannot be " .text = "List of terminal features, used if they cannot be "
"automatically detected." "automatically detected."

6
tmux.1
View File

@ -3656,6 +3656,12 @@ Allows setting the cursor style.
Supports extended keys. Supports extended keys.
.It focus .It focus
Supports focus reporting. Supports focus reporting.
.It ignorefkeys
Ignore function keys from
.Xr terminfo 5
and use the
.Nm
internal set only.
.It margins .It margins
Supports DECSLRM margins. Supports DECSLRM margins.
.It mouse .It mouse

View File

@ -250,6 +250,80 @@ static const struct tty_feature tty_feature_rectfill = {
TERM_DECFRA TERM_DECFRA
}; };
/* Use builtin function keys only. */
static const char *tty_feature_ignorefkeys_capabilities[] = {
"kf0@",
"kf1@",
"kf2@",
"kf3@",
"kf4@",
"kf5@",
"kf6@",
"kf7@",
"kf8@",
"kf9@",
"kf10@",
"kf11@",
"kf12@",
"kf13@",
"kf14@",
"kf15@",
"kf16@",
"kf17@",
"kf18@",
"kf19@",
"kf20@",
"kf21@",
"kf22@",
"kf23@",
"kf24@",
"kf25@",
"kf26@",
"kf27@",
"kf28@",
"kf29@",
"kf30@",
"kf31@",
"kf32@",
"kf33@",
"kf34@",
"kf35@",
"kf36@",
"kf37@",
"kf38@",
"kf39@",
"kf40@",
"kf41@",
"kf42@",
"kf43@",
"kf44@",
"kf45@",
"kf46@",
"kf47@",
"kf48@",
"kf49@",
"kf50@",
"kf51@",
"kf52@",
"kf53@",
"kf54@",
"kf55@",
"kf56@",
"kf57@",
"kf58@",
"kf59@",
"kf60@",
"kf61@",
"kf62@",
"kf63@",
NULL
};
static const struct tty_feature tty_feature_ignorefkeys = {
"ignorefkeys",
tty_feature_ignorefkeys_capabilities,
0
};
/* Available terminal features. */ /* Available terminal features. */
static const struct tty_feature *tty_features[] = { static const struct tty_feature *tty_features[] = {
&tty_feature_256, &tty_feature_256,
@ -259,6 +333,7 @@ static const struct tty_feature *tty_features[] = {
&tty_feature_cstyle, &tty_feature_cstyle,
&tty_feature_extkeys, &tty_feature_extkeys,
&tty_feature_focus, &tty_feature_focus,
&tty_feature_ignorefkeys,
&tty_feature_margins, &tty_feature_margins,
&tty_feature_mouse, &tty_feature_mouse,
&tty_feature_osc7, &tty_feature_osc7,
@ -372,7 +447,7 @@ tty_default_features(int *feat, const char *name, u_int version)
",ccolour,cstyle,focus,overline,usstyle" ",ccolour,cstyle,focus,overline,usstyle"
}, },
{ .name = "rxvt-unicode", { .name = "rxvt-unicode",
.features = "256,bpaste,ccolour,cstyle,mouse,title" .features = "256,bpaste,ccolour,cstyle,mouse,title,ignorefkeys"
}, },
{ .name = "iTerm2", { .name = "iTerm2",
.features = TTY_FEATURES_BASE_MODERN_XTERM .features = TTY_FEATURES_BASE_MODERN_XTERM

View File

@ -126,7 +126,7 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033\033[C", KEYC_RIGHT|KEYC_CURSOR|KEYC_META }, { "\033\033[C", KEYC_RIGHT|KEYC_CURSOR|KEYC_META },
{ "\033\033[D", KEYC_LEFT|KEYC_CURSOR|KEYC_META }, { "\033\033[D", KEYC_LEFT|KEYC_CURSOR|KEYC_META },
/* Other (xterm) "cursor" keys. */ /* Other xterm keys. */
{ "\033OH", KEYC_HOME }, { "\033OH", KEYC_HOME },
{ "\033OF", KEYC_END }, { "\033OF", KEYC_END },
@ -139,7 +139,7 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033\033[H", KEYC_HOME|KEYC_META|KEYC_IMPLIED_META }, { "\033\033[H", KEYC_HOME|KEYC_META|KEYC_IMPLIED_META },
{ "\033\033[F", KEYC_END|KEYC_META|KEYC_IMPLIED_META }, { "\033\033[F", KEYC_END|KEYC_META|KEYC_IMPLIED_META },
/* rxvt-style arrow + modifier keys. */ /* rxvt arrow keys. */
{ "\033Oa", KEYC_UP|KEYC_CTRL }, { "\033Oa", KEYC_UP|KEYC_CTRL },
{ "\033Ob", KEYC_DOWN|KEYC_CTRL }, { "\033Ob", KEYC_DOWN|KEYC_CTRL },
{ "\033Oc", KEYC_RIGHT|KEYC_CTRL }, { "\033Oc", KEYC_RIGHT|KEYC_CTRL },
@ -150,7 +150,31 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033[c", KEYC_RIGHT|KEYC_SHIFT }, { "\033[c", KEYC_RIGHT|KEYC_SHIFT },
{ "\033[d", KEYC_LEFT|KEYC_SHIFT }, { "\033[d", KEYC_LEFT|KEYC_SHIFT },
/* rxvt-style function + modifier keys (C = ^, S = $, C-S = @). */ /* rxvt function keys. */
{ "\033[11~", KEYC_F1 },
{ "\033[12~", KEYC_F2 },
{ "\033[13~", KEYC_F3 },
{ "\033[14~", KEYC_F4 },
{ "\033[15~", KEYC_F5 },
{ "\033[17~", KEYC_F6 },
{ "\033[18~", KEYC_F7 },
{ "\033[19~", KEYC_F8 },
{ "\033[20~", KEYC_F9 },
{ "\033[21~", KEYC_F10 },
{ "\033[23~", KEYC_F1|KEYC_SHIFT },
{ "\033[24~", KEYC_F2|KEYC_SHIFT },
{ "\033[25~", KEYC_F3|KEYC_SHIFT },
{ "\033[26~", KEYC_F4|KEYC_SHIFT },
{ "\033[28~", KEYC_F5|KEYC_SHIFT },
{ "\033[29~", KEYC_F6|KEYC_SHIFT },
{ "\033[31~", KEYC_F7|KEYC_SHIFT },
{ "\033[32~", KEYC_F8|KEYC_SHIFT },
{ "\033[33~", KEYC_F9|KEYC_SHIFT },
{ "\033[34~", KEYC_F10|KEYC_SHIFT },
{ "\033[23$", KEYC_F11|KEYC_SHIFT },
{ "\033[24$", KEYC_F12|KEYC_SHIFT },
{ "\033[11^", KEYC_F1|KEYC_CTRL }, { "\033[11^", KEYC_F1|KEYC_CTRL },
{ "\033[12^", KEYC_F2|KEYC_CTRL }, { "\033[12^", KEYC_F2|KEYC_CTRL },
{ "\033[13^", KEYC_F3|KEYC_CTRL }, { "\033[13^", KEYC_F3|KEYC_CTRL },
@ -163,31 +187,6 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033[21^", KEYC_F10|KEYC_CTRL }, { "\033[21^", KEYC_F10|KEYC_CTRL },
{ "\033[23^", KEYC_F11|KEYC_CTRL }, { "\033[23^", KEYC_F11|KEYC_CTRL },
{ "\033[24^", KEYC_F12|KEYC_CTRL }, { "\033[24^", KEYC_F12|KEYC_CTRL },
{ "\033[2^", KEYC_IC|KEYC_CTRL },
{ "\033[3^", KEYC_DC|KEYC_CTRL },
{ "\033[7^", KEYC_HOME|KEYC_CTRL },
{ "\033[8^", KEYC_END|KEYC_CTRL },
{ "\033[6^", KEYC_NPAGE|KEYC_CTRL },
{ "\033[5^", KEYC_PPAGE|KEYC_CTRL },
{ "\033[11$", KEYC_F1|KEYC_SHIFT },
{ "\033[12$", KEYC_F2|KEYC_SHIFT },
{ "\033[13$", KEYC_F3|KEYC_SHIFT },
{ "\033[14$", KEYC_F4|KEYC_SHIFT },
{ "\033[15$", KEYC_F5|KEYC_SHIFT },
{ "\033[17$", KEYC_F6|KEYC_SHIFT },
{ "\033[18$", KEYC_F7|KEYC_SHIFT },
{ "\033[19$", KEYC_F8|KEYC_SHIFT },
{ "\033[20$", KEYC_F9|KEYC_SHIFT },
{ "\033[21$", KEYC_F10|KEYC_SHIFT },
{ "\033[23$", KEYC_F11|KEYC_SHIFT },
{ "\033[24$", KEYC_F12|KEYC_SHIFT },
{ "\033[2$", KEYC_IC|KEYC_SHIFT },
{ "\033[3$", KEYC_DC|KEYC_SHIFT },
{ "\033[7$", KEYC_HOME|KEYC_SHIFT },
{ "\033[8$", KEYC_END|KEYC_SHIFT },
{ "\033[6$", KEYC_NPAGE|KEYC_SHIFT },
{ "\033[5$", KEYC_PPAGE|KEYC_SHIFT },
{ "\033[11@", KEYC_F1|KEYC_CTRL|KEYC_SHIFT }, { "\033[11@", KEYC_F1|KEYC_CTRL|KEYC_SHIFT },
{ "\033[12@", KEYC_F2|KEYC_CTRL|KEYC_SHIFT }, { "\033[12@", KEYC_F2|KEYC_CTRL|KEYC_SHIFT },
@ -201,12 +200,6 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033[21@", KEYC_F10|KEYC_CTRL|KEYC_SHIFT }, { "\033[21@", KEYC_F10|KEYC_CTRL|KEYC_SHIFT },
{ "\033[23@", KEYC_F11|KEYC_CTRL|KEYC_SHIFT }, { "\033[23@", KEYC_F11|KEYC_CTRL|KEYC_SHIFT },
{ "\033[24@", KEYC_F12|KEYC_CTRL|KEYC_SHIFT }, { "\033[24@", KEYC_F12|KEYC_CTRL|KEYC_SHIFT },
{ "\033[2@", KEYC_IC|KEYC_CTRL|KEYC_SHIFT },
{ "\033[3@", KEYC_DC|KEYC_CTRL|KEYC_SHIFT },
{ "\033[7@", KEYC_HOME|KEYC_CTRL|KEYC_SHIFT },
{ "\033[8@", KEYC_END|KEYC_CTRL|KEYC_SHIFT },
{ "\033[6@", KEYC_NPAGE|KEYC_CTRL|KEYC_SHIFT },
{ "\033[5@", KEYC_PPAGE|KEYC_CTRL|KEYC_SHIFT },
/* Focus tracking. */ /* Focus tracking. */
{ "\033[I", KEYC_FOCUS_IN }, { "\033[I", KEYC_FOCUS_IN },