summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-06-14 07:29:01 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-06-14 07:29:01 +0000
commit9e54701c071cbb56b4c007ba9796edf388ac8f09 (patch)
tree899a575277ace931ec20e507c910393c860e18cd
parenta7c2b2a18f08f018de81ca3ef214fcd81b77ace5 (diff)
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.
-rw-r--r--usr.bin/tmux/options-table.c5
-rw-r--r--usr.bin/tmux/tmux.110
-rw-r--r--usr.bin/tmux/tty-features.c79
-rw-r--r--usr.bin/tmux/tty-keys.c63
4 files changed, 116 insertions, 41 deletions
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index e1748711fff..99820aaab6d 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.162 2022/03/24 12:07:25 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.163 2022/06/14 07:29:00 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index e5217b2a742..25eb227d176 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.890 2022/05/30 13:07:06 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.891 2022/06/14 07:29:00 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 30 2022 $
+.Dd $Mdocdate: June 14 2022 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -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/usr.bin/tmux/tty-features.c b/usr.bin/tmux/tty-features.c
index 7843cf68570..631a7eb76ab 100644
--- a/usr.bin/tmux/tty-features.c
+++ b/usr.bin/tmux/tty-features.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-features.c,v 1.23 2022/05/30 12:57:31 nicm Exp $ */
+/* $OpenBSD: tty-features.c,v 1.24 2022/06/14 07:29:00 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 2c6458e907a..d520f61af2c 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.156 2022/06/01 15:43:22 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.157 2022/06/14 07:29:00 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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 },