diff --git a/options-table.c b/options-table.c index 4e68af00..d1e65f15 100644 --- a/options-table.c +++ b/options-table.c @@ -363,7 +363,8 @@ const struct options_table_entry options_table[] = { .scope = OPTIONS_TABLE_SERVER, .flags = OPTIONS_TABLE_IS_ARRAY, .default_str = "xterm*:clipboard:ccolour:cstyle:focus:title," - "screen*:title", + "screen*:title," + "rxvt*:ignorefkeys", .separator = ",", .text = "List of terminal features, used if they cannot be " "automatically detected." diff --git a/tmux.1 b/tmux.1 index c58597c6..f06a42a4 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3656,6 +3656,12 @@ Allows setting the cursor style. Supports extended keys. .It focus Supports focus reporting. +.It ignorefkeys +Ignore function keys from +.Xr terminfo 5 +and use the +.Nm +internal set only. .It margins Supports DECSLRM margins. .It mouse diff --git a/tty-features.c b/tty-features.c index 2848b4d6..477925e3 100644 --- a/tty-features.c +++ b/tty-features.c @@ -250,6 +250,80 @@ static const struct tty_feature tty_feature_rectfill = { 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. */ static const struct tty_feature *tty_features[] = { &tty_feature_256, @@ -259,6 +333,7 @@ static const struct tty_feature *tty_features[] = { &tty_feature_cstyle, &tty_feature_extkeys, &tty_feature_focus, + &tty_feature_ignorefkeys, &tty_feature_margins, &tty_feature_mouse, &tty_feature_osc7, @@ -372,7 +447,7 @@ tty_default_features(int *feat, const char *name, u_int version) ",ccolour,cstyle,focus,overline,usstyle" }, { .name = "rxvt-unicode", - .features = "256,bpaste,ccolour,cstyle,mouse,title" + .features = "256,bpaste,ccolour,cstyle,mouse,title,ignorefkeys" }, { .name = "iTerm2", .features = TTY_FEATURES_BASE_MODERN_XTERM diff --git a/tty-keys.c b/tty-keys.c index d26dbf1e..4a712d42 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -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[D", KEYC_LEFT|KEYC_CURSOR|KEYC_META }, - /* Other (xterm) "cursor" keys. */ + /* Other xterm keys. */ { "\033OH", KEYC_HOME }, { "\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[F", KEYC_END|KEYC_META|KEYC_IMPLIED_META }, - /* rxvt-style arrow + modifier keys. */ + /* rxvt arrow keys. */ { "\033Oa", KEYC_UP|KEYC_CTRL }, { "\033Ob", KEYC_DOWN|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[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[12^", KEYC_F2|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[23^", KEYC_F11|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[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[23@", KEYC_F11|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. */ { "\033[I", KEYC_FOCUS_IN },