Add feature and capabilities for focus reporting. Also document AX and XT even

though they aren't tmux's.
pull/2195/head
Nicholas Marriott 2020-04-24 07:37:11 +01:00
parent 5d69b9c4a7
commit 61550ac2e0
5 changed files with 48 additions and 11 deletions

20
tmux.1
View File

@ -5556,6 +5556,10 @@ It is not normally necessary to set these manually, instead the
.Ic terminal-features
option should be used.
.Bl -tag -width Ds
.It Em \&AX
An existing extension that tells
.Nm
the terminal supports default colours.
.It Em \&Cs , Cr
Set the cursor colour.
The first takes a single string argument and is used to set the colour;
@ -5568,8 +5572,19 @@ $ printf '\e033]12;red\e033\e\e'
.Ed
.It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg
Set, clear, disable or enable DECSLRM margins.
These are set automatically if the terminal reports it is
.Em VT420
compatible.
.It Em \&Dsbp , \&Enbp
Disable and enable bracketed paste.
These are set automatically if the
.Em XT
capability is present.
.It Em \&Dsfcs , \&Enfcs
Disable and enable focus reporting.
These are set automatically if the
.Em XT
capability is present.
.It Em \&Smol
Enable the overline attribute.
.It Em \&Smulx
@ -5620,6 +5635,11 @@ See the
option above and the
.Xr xterm 1
man page.
.It Em \&XT
This is an existing extension capability that tmux uses to mean that the
terminal supports the
.Xr xterm 1
title set sequences and to automatically set some of the capabilities above.
.El
.Sh CONTROL MODE
.Nm

2
tmux.h
View File

@ -282,6 +282,7 @@ enum tty_code_code {
TTYC_DL,
TTYC_DL1,
TTYC_DSBP,
TTYC_DSFCS,
TTYC_DSMG,
TTYC_E3,
TTYC_ECH,
@ -290,6 +291,7 @@ enum tty_code_code {
TTYC_EL1,
TTYC_ENACS,
TTYC_ENBP,
TTYC_ENFCS,
TTYC_ENMG,
TTYC_FSL,
TTYC_HOME,

View File

@ -26,7 +26,6 @@
/*
* Still hardcoded:
* - mouse (under kmous capability);
* - focus events (under XT and focus-events option);
* - default colours (under AX or op capabilities);
* - AIX colours (under colors >= 16);
* - alternate escape (under XT).
@ -122,9 +121,9 @@ static struct tty_feature tty_feature_usstyle = {
0
};
/* Terminal supports cursor bracketed paste. */
/* Terminal supports bracketed paste. */
static const char *tty_feature_bpaste_capabilities[] = {
"Enbp=\E[?2004h",
"Enbp=\\E[?2004h",
"Dsbp=\\E[?2004l",
NULL
};
@ -134,6 +133,18 @@ static struct tty_feature tty_feature_bpaste = {
0
};
/* Terminal supports focus reporting. */
static const char *tty_feature_focus_capabilities[] = {
"Enfcs=\\E[?1004h",
"Dsfcs=\\E[?1004l",
NULL
};
static struct tty_feature tty_feature_focus = {
"focus",
tty_feature_focus_capabilities,
0
};
/* Terminal supports cursor styles. */
static const char *tty_feature_cstyle_capabilities[] = {
"Ss=\\E[%p1%d q",
@ -205,9 +216,10 @@ static struct tty_feature tty_feature_rectfill = {
static const struct tty_feature *tty_features[] = {
&tty_feature_256,
&tty_feature_bpaste,
&tty_feature_clipboard,
&tty_feature_ccolour,
&tty_feature_clipboard,
&tty_feature_cstyle,
&tty_feature_focus,
&tty_feature_margins,
&tty_feature_overline,
&tty_feature_rectfill,
@ -308,20 +320,21 @@ tty_default_features(int *feat, const char *name, u_int version)
u_int version;
const char *features;
} table[] = {
#define TTY_FEATURES_BASE_MODERN_XTERM "256,RGB,bpaste,clipboard,strikethrough,title"
{ .name = "mintty",
.features = "256,RGB,bpaste,ccolour,clipboard,cstyle,margins,overline,strikethrough,title"
.features = TTY_FEATURES_BASE_MODERN_XTERM ",ccolour,cstyle,margins,overline"
},
{ .name = "tmux",
.features = "256,RGB,bpaste,ccolour,clipboard,cstyle,overline,strikethough,title,usstyle"
.features = TTY_FEATURES_BASE_MODERN_XTERM ",ccolour,cstyle,focus,overline,usstyle"
},
{ .name = "rxvt-unicode",
.features = "256,title"
},
{ .name = "iTerm2",
.features = "256,RGB,bpaste,clipboard,cstyle,margins,strikethrough,sync,title"
.features = TTY_FEATURES_BASE_MODERN_XTERM ",cstyle,margins,sync"
},
{ .name = "XTerm",
.features = "256,RGB,bpaste,ccolour,clipboard,cstyle,margins,rectfill,strikethrough,title"
.features = TTY_FEATURES_BASE_MODERN_XTERM ",ccolour,cstyle,focus,margins,rectfill"
}
};
u_int i;

View File

@ -86,6 +86,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_DIM] = { TTYCODE_STRING, "dim" },
[TTYC_DL1] = { TTYCODE_STRING, "dl1" },
[TTYC_DL] = { TTYCODE_STRING, "dl" },
[TTYC_DSFCS] = { TTYCODE_STRING, "Dsfcs" },
[TTYC_DSBP] = { TTYCODE_STRING, "Dsbp" },
[TTYC_DSMG] = { TTYCODE_STRING, "Dsmg" },
[TTYC_E3] = { TTYCODE_STRING, "E3" },
@ -95,6 +96,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_EL] = { TTYCODE_STRING, "el" },
[TTYC_ENACS] = { TTYCODE_STRING, "enacs" },
[TTYC_ENBP] = { TTYCODE_STRING, "Enbp" },
[TTYC_ENFCS] = { TTYCODE_STRING, "Enfcs" },
[TTYC_ENMG] = { TTYCODE_STRING, "Enmg" },
[TTYC_FSL] = { TTYCODE_STRING, "fsl" },
[TTYC_HOME] = { TTYCODE_STRING, "home" },
@ -567,7 +569,7 @@ tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause)
/* Add some features if terminal has XT. */
if (tty_term_flag(term, TTYC_XT))
tty_add_features(feat, "bpaste,title", ",");
tty_add_features(feat, "bpaste,focus,title", ",");
/* Apply the features and overrides again. */
tty_apply_features(term, *feat);

4
tty.c
View File

@ -333,7 +333,7 @@ tty_start_tty(struct tty *tty)
if (tty_term_flag(tty->term, TTYC_XT)) {
if (options_get_number(global_options, "focus-events")) {
tty->flags |= TTY_FOCUS;
tty_puts(tty, "\033[?1004h");
tty_raw(tty, tty_term_string(tty->term, TTYC_ENFCS));
}
tty_puts(tty, "\033[?7727h");
}
@ -420,7 +420,7 @@ tty_stop_tty(struct tty *tty)
if (tty_term_flag(tty->term, TTYC_XT)) {
if (tty->flags & TTY_FOCUS) {
tty->flags &= ~TTY_FOCUS;
tty_raw(tty, "\033[?1004l");
tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS));
}
tty_raw(tty, "\033[?7727l");
}