sync code with last improvements from OpenBSD
This commit is contained in:
parent
361861c7dd
commit
151b4b8168
25 changed files with 175 additions and 79 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: server-client.c,v 1.401 2023/08/17 14:10:28 nicm Exp $ */
|
||||
/* $OpenBSD: server-client.c,v 1.402 2023/09/02 20:03:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -2770,6 +2770,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
|
|||
break;
|
||||
server_client_update_latest(c);
|
||||
tty_resize(&c->tty);
|
||||
tty_repeat_requests(&c->tty);
|
||||
recalculate_sizes();
|
||||
if (c->overlay_resize == NULL)
|
||||
server_client_clear_overlay(c);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: session.c,v 1.95 2023/09/01 13:48:54 nicm Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.96 2023/09/02 08:38:37 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -687,8 +687,10 @@ session_group_synchronize1(struct session *target, struct session *s)
|
|||
TAILQ_INIT(&s->lastw);
|
||||
TAILQ_FOREACH(wl, &old_lastw, sentry) {
|
||||
wl2 = winlink_find_by_index(&s->windows, wl->idx);
|
||||
if (wl2 != NULL)
|
||||
if (wl2 != NULL) {
|
||||
TAILQ_INSERT_TAIL(&s->lastw, wl2, sentry);
|
||||
wl2->flags |= WINLINK_VISITED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Then free the old winlinks list. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: tmux.1,v 1.930 2023/09/01 13:48:54 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.931 2023/09/02 09:17:23 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: September 1 2023 $
|
||||
.Dd $Mdocdate: September 2 2023 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -6802,9 +6802,15 @@ Set a styled underscore.
|
|||
The single parameter is one of: 0 for no underscore, 1 for normal
|
||||
underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
|
||||
underscore and 5 for dashed underscore.
|
||||
.It Em \&Setulc , \&ol
|
||||
.It Em \&Setulc , \&Setulc1, \&ol
|
||||
Set the underscore colour or reset to the default.
|
||||
The argument is (red * 65536) + (green * 256) + blue where each is between 0
|
||||
.Em Setulc
|
||||
is for RGB colours and
|
||||
.Em Setulc1
|
||||
for ANSI or 256 colours.
|
||||
The
|
||||
.Em Setulc
|
||||
argument is (red * 65536) + (green * 256) + blue where each is between 0
|
||||
and 255.
|
||||
.It Em \&Ss , Se
|
||||
Set or reset the cursor style.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tmux.h,v 1.1207 2023/09/01 14:29:11 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.1209 2023/09/02 20:03:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -536,6 +536,7 @@ enum tty_code_code {
|
|||
TTYC_SETRGBB,
|
||||
TTYC_SETRGBF,
|
||||
TTYC_SETULC,
|
||||
TTYC_SETULC1,
|
||||
TTYC_SGR0,
|
||||
TTYC_SITM,
|
||||
TTYC_SMACS,
|
||||
|
@ -1385,6 +1386,7 @@ struct tty {
|
|||
struct client *client;
|
||||
struct event start_timer;
|
||||
struct event clipboard_timer;
|
||||
time_t last_requests;
|
||||
|
||||
u_int sx;
|
||||
u_int sy;
|
||||
|
@ -1436,10 +1438,8 @@ struct tty {
|
|||
#define TTY_HAVEXDA 0x200
|
||||
#define TTY_SYNCING 0x400
|
||||
#define TTY_HAVEDA2 0x800 /* Secondary DA. */
|
||||
#define TTY_HAVEFG 0x1000
|
||||
#define TTY_HAVEBG 0x2000
|
||||
#define TTY_ALL_REQUEST_FLAGS \
|
||||
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVEFG|TTY_HAVEBG)
|
||||
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA)
|
||||
int flags;
|
||||
|
||||
struct tty_term *term;
|
||||
|
@ -2332,6 +2332,7 @@ void tty_resize(struct tty *);
|
|||
void tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
|
||||
void tty_start_tty(struct tty *);
|
||||
void tty_send_requests(struct tty *);
|
||||
void tty_repeat_requests(struct tty *);
|
||||
void tty_stop_tty(struct tty *);
|
||||
void tty_set_title(struct tty *, const char *);
|
||||
void tty_set_path(struct tty *, const char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty-features.c,v 1.28 2022/11/11 08:44:11 nicm Exp $ */
|
||||
/* $OpenBSD: tty-features.c,v 1.29 2023/09/02 09:17:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -145,6 +145,7 @@ static const struct tty_feature tty_feature_overline = {
|
|||
static const char *const tty_feature_usstyle_capabilities[] = {
|
||||
"Smulx=\\E[4::%p1%dm",
|
||||
"Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m",
|
||||
"Setulc1=\\E[58::5::%p1%dm",
|
||||
"ol=\\E[59m",
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty-keys.c,v 1.167 2023/06/30 13:19:32 nicm Exp $ */
|
||||
/* $OpenBSD: tty-keys.c,v 1.168 2023/09/02 20:03:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -1492,8 +1492,6 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size)
|
|||
int n;
|
||||
|
||||
*size = 0;
|
||||
if ((tty->flags & TTY_HAVEFG) && (tty->flags & TTY_HAVEBG))
|
||||
return (-1);
|
||||
|
||||
/* First four bytes are always \033]1 and 0 or 1 and ;. */
|
||||
if (buf[0] != '\033')
|
||||
|
@ -1539,11 +1537,9 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size)
|
|||
if (n != -1 && buf[3] == '0') {
|
||||
log_debug("%s: foreground is %s", c->name, colour_tostring(n));
|
||||
tty->fg = n;
|
||||
tty->flags |= TTY_HAVEFG;
|
||||
} else if (n != -1) {
|
||||
log_debug("%s: background is %s", c->name, colour_tostring(n));
|
||||
tty->bg = n;
|
||||
tty->flags |= TTY_HAVEBG;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty-term.c,v 1.99 2023/06/30 13:19:32 nicm Exp $ */
|
||||
/* $OpenBSD: tty-term.c,v 1.100 2023/09/02 09:17:23 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -264,6 +264,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
|
||||
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
|
||||
[TTYC_SETULC] = { TTYCODE_STRING, "Setulc" },
|
||||
[TTYC_SETULC1] = { TTYCODE_STRING, "Setulc1" },
|
||||
[TTYC_SE] = { TTYCODE_STRING, "Se" },
|
||||
[TTYC_SXL] = { TTYCODE_FLAG, "Sxl" },
|
||||
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tty.c,v 1.432 2023/07/13 06:03:48 nicm Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.434 2023/09/02 20:03:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -82,6 +82,7 @@ static void tty_check_overlay_range(struct tty *, u_int, u_int, u_int,
|
|||
#define TTY_BLOCK_STOP(tty) (1 + ((tty)->sx * (tty)->sy) / 8)
|
||||
|
||||
#define TTY_QUERY_TIMEOUT 5
|
||||
#define TTY_REQUEST_LIMIT 30
|
||||
|
||||
void
|
||||
tty_create_log(void)
|
||||
|
@ -369,12 +370,29 @@ tty_send_requests(struct tty *tty)
|
|||
tty_puts(tty, "\033[>c");
|
||||
if (~tty->flags & TTY_HAVEXDA)
|
||||
tty_puts(tty, "\033[>q");
|
||||
if (~tty->flags & TTY_HAVEFG)
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
if (~tty->flags & TTY_HAVEBG)
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
} else
|
||||
tty->flags |= TTY_ALL_REQUEST_FLAGS;
|
||||
tty->last_requests = time (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
tty_repeat_requests(struct tty *tty)
|
||||
{
|
||||
time_t t = time (NULL);
|
||||
|
||||
if (~tty->flags & TTY_STARTED)
|
||||
return;
|
||||
|
||||
if (t - tty->last_requests <= TTY_REQUEST_LIMIT)
|
||||
return;
|
||||
tty->last_requests = t;
|
||||
|
||||
if (tty->term->flags & TERM_VT100LIKE) {
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2814,11 +2832,13 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
|
|||
gc->us = c;
|
||||
}
|
||||
|
||||
/* Underscore colour is set as RGB so convert. */
|
||||
if ((c = colour_force_rgb (gc->us)) == -1)
|
||||
gc->us = 8;
|
||||
else
|
||||
gc->us = c;
|
||||
/* Convert underscore colour if only RGB can be supported. */
|
||||
if (!tty_term_has(tty->term, TTYC_SETULC1)) {
|
||||
if ((c = colour_force_rgb (gc->us)) == -1)
|
||||
gc->us = 8;
|
||||
else
|
||||
gc->us = c;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2898,9 +2918,17 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc)
|
|||
goto save;
|
||||
}
|
||||
|
||||
/* Must be an RGB colour - this should never happen. */
|
||||
if (~gc->us & COLOUR_FLAG_RGB)
|
||||
/*
|
||||
* If this is not an RGB colour, use Setulc1 if it exists, otherwise
|
||||
* convert.
|
||||
*/
|
||||
if (~gc->us & COLOUR_FLAG_RGB) {
|
||||
c = gc->us;
|
||||
if ((~c & COLOUR_FLAG_256) && (c >= 90 && c <= 97))
|
||||
c -= 82;
|
||||
tty_putcode_i(tty, TTYC_SETULC1, c & ~COLOUR_FLAG_256);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setulc and setal follows the ncurses(3) one argument "direct colour"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue