Add a feature for mintty's application escape to avoid dodgy terminals

whinging about not supporting it, GitHub issue 5626 from Pete Dietl.
This commit is contained in:
nicm
2026-09-22 06:58:05 +00:00
committed by tmux update bot
parent 19b7660778
commit 83f62d0acc
5 changed files with 31 additions and 10 deletions

9
tmux.1
View File

@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1171 2026/09/21 10:22:31 nicm Exp $ .\" $OpenBSD: tmux.1,v 1.1172 2026/09/22 06:58:05 nicm Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\" .\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: September 21 2026 $ .Dd $Mdocdate: September 22 2026 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@@ -5083,6 +5083,9 @@ The available features are:
.Bl -tag -width Ds .Bl -tag -width Ds
.It 256 .It 256
Supports 256 colours with the SGR escape sequences. Supports 256 colours with the SGR escape sequences.
.It appesc
Supports application escape key mode, where the Escape key sends a sequence
that cannot be mistaken for the start of another key.
.It clipboard .It clipboard
Allows setting the system clipboard. Allows setting the system clipboard.
.It ccolour .It ccolour
@@ -8831,6 +8834,8 @@ These are set automatically if the
capability is present. capability is present.
.It Em \&Dseks , \&Eneks .It Em \&Dseks , \&Eneks
Disable and enable extended keys. Disable and enable extended keys.
.It Em \&Dsesc , \&Enesc
Disable and enable application escape key mode.
.It Em \&Dsfcs , \&Enfcs .It Em \&Dsfcs , \&Enfcs
Disable and enable focus reporting. Disable and enable focus reporting.
These are set automatically if the These are set automatically if the

4
tmux.h
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1445 2026/09/22 06:46:50 nicm Exp $ */ /* $OpenBSD: tmux.h,v 1.1446 2026/09/22 06:58:06 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -455,6 +455,7 @@ enum tty_code_code {
TTYC_DL1, TTYC_DL1,
TTYC_DSBP, TTYC_DSBP,
TTYC_DSEKS, TTYC_DSEKS,
TTYC_DSESC,
TTYC_DSFCS, TTYC_DSFCS,
TTYC_DSMG, TTYC_DSMG,
TTYC_E3, TTYC_E3,
@@ -465,6 +466,7 @@ enum tty_code_code {
TTYC_ENACS, TTYC_ENACS,
TTYC_ENBP, TTYC_ENBP,
TTYC_ENEKS, TTYC_ENEKS,
TTYC_ENESC,
TTYC_ENFCS, TTYC_ENFCS,
TTYC_ENMG, TTYC_ENMG,
TTYC_FSL, TTYC_FSL,

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty-features.c,v 1.43 2026/08/31 12:41:03 kirill Exp $ */ /* $OpenBSD: tty-features.c,v 1.44 2026/09/22 06:58:06 nicm Exp $ */
/* /*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -179,6 +179,18 @@ static const struct tty_feature tty_feature_focus = {
0 0
}; };
/* Terminal supports application escape key mode. */
static const char *const tty_feature_appesc_capabilities[] = {
"Enesc=\\E[?7727h",
"Dsesc=\\E[?7727l",
NULL
};
static const struct tty_feature tty_feature_appesc = {
"appesc",
tty_feature_appesc_capabilities,
0
};
/* Terminal supports cursor styles. */ /* Terminal supports cursor styles. */
static const char *const tty_feature_cstyle_capabilities[] = { static const char *const tty_feature_cstyle_capabilities[] = {
"Ss=\\E[%p1%d q", "Ss=\\E[%p1%d q",
@@ -368,6 +380,7 @@ static const struct tty_feature tty_feature_utf8 = {
/* Available terminal features. */ /* Available terminal features. */
static const struct tty_feature *const tty_features[] = { static const struct tty_feature *const tty_features[] = {
&tty_feature_256, &tty_feature_256,
&tty_feature_appesc,
&tty_feature_bpaste, &tty_feature_bpaste,
&tty_feature_ccolour, &tty_feature_ccolour,
&tty_feature_clipboard, &tty_feature_clipboard,
@@ -558,6 +571,7 @@ tty_default_features(struct client *c, const char *name, u_int version)
"256,RGB,bpaste,clipboard,mouse,strikethrough,title" "256,RGB,bpaste,clipboard,mouse,strikethrough,title"
{ .name = "mintty", { .name = "mintty",
.features = TTY_FEATURES_BASE_MODERN_XTERM "," .features = TTY_FEATURES_BASE_MODERN_XTERM ","
"appesc,"
"ccolour," "ccolour,"
"cstyle," "cstyle,"
"extkeys," "extkeys,"

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty-term.c,v 1.109 2026/08/25 08:37:08 nicm Exp $ */ /* $OpenBSD: tty-term.c,v 1.110 2026/09/22 06:58:06 nicm Exp $ */
/* /*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -87,6 +87,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_DL1] = { TTYCODE_STRING, "dl1" }, [TTYC_DL1] = { TTYCODE_STRING, "dl1" },
[TTYC_DL] = { TTYCODE_STRING, "dl" }, [TTYC_DL] = { TTYCODE_STRING, "dl" },
[TTYC_DSEKS] = { TTYCODE_STRING, "Dseks" }, [TTYC_DSEKS] = { TTYCODE_STRING, "Dseks" },
[TTYC_DSESC] = { TTYCODE_STRING, "Dsesc" },
[TTYC_DSFCS] = { TTYCODE_STRING, "Dsfcs" }, [TTYC_DSFCS] = { TTYCODE_STRING, "Dsfcs" },
[TTYC_DSBP] = { TTYCODE_STRING, "Dsbp" }, [TTYC_DSBP] = { TTYCODE_STRING, "Dsbp" },
[TTYC_DSMG] = { TTYCODE_STRING, "Dsmg" }, [TTYC_DSMG] = { TTYCODE_STRING, "Dsmg" },
@@ -98,6 +99,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_ENACS] = { TTYCODE_STRING, "enacs" }, [TTYC_ENACS] = { TTYCODE_STRING, "enacs" },
[TTYC_ENBP] = { TTYCODE_STRING, "Enbp" }, [TTYC_ENBP] = { TTYCODE_STRING, "Enbp" },
[TTYC_ENEKS] = { TTYCODE_STRING, "Eneks" }, [TTYC_ENEKS] = { TTYCODE_STRING, "Eneks" },
[TTYC_ENESC] = { TTYCODE_STRING, "Enesc" },
[TTYC_ENFCS] = { TTYCODE_STRING, "Enfcs" }, [TTYC_ENFCS] = { TTYCODE_STRING, "Enfcs" },
[TTYC_ENMG] = { TTYCODE_STRING, "Enmg" }, [TTYC_ENMG] = { TTYCODE_STRING, "Enmg" },
[TTYC_FSL] = { TTYCODE_STRING, "fsl" }, [TTYC_FSL] = { TTYCODE_STRING, "fsl" },

8
tty.c
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty.c,v 1.481 2026/09/21 10:22:31 nicm Exp $ */ /* $OpenBSD: tty.c,v 1.482 2026/09/22 06:58:06 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -497,8 +497,7 @@ tty_stop_tty(struct tty *tty)
if (tty_term_has(tty->term, TTYC_DSBP)) if (tty_term_has(tty->term, TTYC_DSBP))
tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP)); tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP));
if (tty->term->flags & TERM_VT100LIKE) tty_raw(tty, tty_term_string(tty->term, TTYC_DSESC));
tty_raw(tty, "\033[?7727l");
tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS)); tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS));
tty_raw(tty, tty_term_string(tty->term, TTYC_DSEKS)); tty_raw(tty, tty_term_string(tty->term, TTYC_DSEKS));
@@ -555,8 +554,7 @@ tty_update_features(struct tty *tty)
tty_puts(tty, tty_term_string(tty->term, TTYC_ENEKS)); tty_puts(tty, tty_term_string(tty->term, TTYC_ENEKS));
if (options_get_number(global_options, "focus-events")) if (options_get_number(global_options, "focus-events"))
tty_puts(tty, tty_term_string(tty->term, TTYC_ENFCS)); tty_puts(tty, tty_term_string(tty->term, TTYC_ENFCS));
if (tty->term->flags & TERM_VT100LIKE) tty_puts(tty, tty_term_string(tty->term, TTYC_ENESC));
tty_puts(tty, "\033[?7727h");
/* /*
* Features might have changed since the first draw during attach. For * Features might have changed since the first draw during attach. For