summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-06-10 07:24:11 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-06-10 07:24:11 +0000
commitaa63b0eb78b8c80916e5ad0252326c5361dbe3ac (patch)
treec2b20f752600ea6e83ef19658ebfa1f87c32f4f8 /usr.bin
parent3660ab15a52d6002c9bf4ec9b4f4775241c1ab46 (diff)
Add an "always" value to the extended-keys option to always forward
these keys to applications inside tmux.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/input.c4
-rw-r--r--usr.bin/tmux/options-table.c8
-rw-r--r--usr.bin/tmux/screen.c6
-rw-r--r--usr.bin/tmux/tmux.129
4 files changed, 34 insertions, 13 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 0ce7a65adfc..c791567db51 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.188 2021/02/18 13:30:24 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.189 2021/06/10 07:24:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1390,6 +1390,8 @@ 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)
+ break;
if (n == 0 || (n == 4 && m == 0))
screen_write_mode_clear(sctx, MODE_KEXTENDED);
else if (n == 4 && (m == 1 || m == 2))
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index 3330e4fcfd2..4df0e8749e2 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.140 2021/03/11 06:41:04 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.141 2021/06/10 07:24:10 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -75,6 +75,9 @@ static const char *options_table_remain_on_exit_list[] = {
static const char *options_table_detach_on_destroy_list[] = {
"off", "on", "no-detached", NULL
};
+static const char *options_table_extended_keys_list[] = {
+ "off", "on", "always", NULL
+};
/* Status line format. */
#define OPTIONS_TABLE_STATUS_FORMAT1 \
@@ -267,8 +270,9 @@ const struct options_table_entry options_table[] = {
},
{ .name = "extended-keys",
- .type = OPTIONS_TABLE_FLAG,
+ .type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_SERVER,
+ .choices = options_table_extended_keys_list,
.default_num = 0,
.text = "Whether to request extended key sequences from terminals "
"that support it."
diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c
index a01ddb33e17..cb8aa867382 100644
--- a/usr.bin/tmux/screen.c
+++ b/usr.bin/tmux/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.70 2021/03/12 08:39:17 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.71 2021/06/10 07:24:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -101,7 +101,9 @@ screen_reinit(struct screen *s)
s->rupper = 0;
s->rlower = screen_size_y(s) - 1;
- s->mode = MODE_CURSOR | MODE_WRAP;
+ s->mode = MODE_CURSOR|MODE_WRAP;
+ if (options_get_number(global_options, "extended-keys") == 2)
+ s->mode |= MODE_KEXTENDED;
if (s->saved_grid != NULL)
screen_alternate_off(s, NULL, 0);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index ffbcdde4d17..dda19bd2e4a 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.835 2021/04/15 05:38:11 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.836 2021/06/10 07:24:10 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: April 15 2021 $
+.Dd $Mdocdate: June 10 2021 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -3418,11 +3418,24 @@ sessions.
.Xc
If enabled, the server will exit when there are no attached clients.
.It Xo Ic extended-keys
-.Op Ic on | off
+.Op Ic on | off | always
.Xc
-When enabled, extended keys are requested from the terminal and if supported
-are recognised by
-.Nm .
+When
+.Ic on
+or
+.Ic always ,
+the escape sequence to enable extended keys is sent to the terminal, if
+.Nm
+knows that it is supported.
+.Nm
+always recognises extended keys itself.
+If this option is
+.Ic on ,
+.Nm
+will only forward extended keys to applications when they request them; if
+.Ic always ,
+.Nm
+will always forward the keys.
.It Xo Ic focus-events
.Op Ic on | off
.Xc
@@ -3501,8 +3514,8 @@ capabilities to be set instead,
is intended for classes of functionality supported in a standard way but not
reported by
.Xr terminfo 5 .
-Care must be taken only to configure this with features the terminal actually
-support.
+Care must be taken to configure this only with features the terminal actually
+supports.
.Pp
This is an array option where each entry is a colon-separated string made up
of a terminal type pattern (matched using