sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-09-01 17:37:08 +00:00
parent f8bbd6dd90
commit 81d24aa0e0
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
16 changed files with 1834 additions and 90 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: OBJ_NAME_add.3,v 1.4 2023/07/21 05:02:53 tb Exp $ .\" $OpenBSD: OBJ_NAME_add.3,v 1.5 2023/09/01 12:13:13 schwarze Exp $
.\" .\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\" .\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: July 21 2023 $ .Dd $Mdocdate: September 1 2023 $
.Dt OBJ_NAME_ADD 3 .Dt OBJ_NAME_ADD 3
.Os .Os
.Sh NAME .Sh NAME
@ -33,7 +33,7 @@
.Fo OBJ_NAME_add .Fo OBJ_NAME_add
.Fa "const char *name" .Fa "const char *name"
.Fa "int type" .Fa "int type"
.Fa "const char *data" .Fa "const char *value"
.Fc .Fc
.Ft int .Ft int
.Fo OBJ_NAME_remove .Fo OBJ_NAME_remove

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sxipio.c,v 1.15 2022/06/28 23:43:12 naddy Exp $ */ /* $OpenBSD: sxipio.c,v 1.16 2023/09/01 16:13:56 kettenis Exp $ */
/* /*
* Copyright (c) 2010 Miodrag Vallat. * Copyright (c) 2010 Miodrag Vallat.
* Copyright (c) 2013 Artturi Alm * Copyright (c) 2013 Artturi Alm
@ -166,6 +166,10 @@ const struct sxipio_pins sxipio_pins[] = {
"allwinner,sun8i-h3-r-pinctrl", "allwinner,sun8i-h3-r-pinctrl",
sun8i_h3_r_pins, nitems(sun8i_h3_r_pins) sun8i_h3_r_pins, nitems(sun8i_h3_r_pins)
}, },
{
"allwinner,sun8i-v3-pinctrl",
sun8i_v3_pins, nitems(sun8i_v3_pins)
},
{ {
"allwinner,sun8i-v3s-pinctrl", "allwinner,sun8i-v3s-pinctrl",
sun8i_v3s_pins, nitems(sun8i_v3s_pins) sun8i_v3s_pins, nitems(sun8i_v3s_pins)

View File

@ -6485,6 +6485,568 @@ const struct sxipio_pin sun8i_h3_r_pins[] = {
} }, } },
}; };
const struct sxipio_pin sun8i_v3_pins[] = {
{ SXIPIO_PIN(B, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart2", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart2", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart2", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart2", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "pwm0", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "pwm1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2c0", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 7), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2c0", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 8), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2c1", 2 },
{ "uart0", 3 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 9), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2c1", 2 },
{ "uart0", 3 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 10), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "jtag", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 11), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "jtag", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 12), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "jtag", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(B, 13), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "jtag", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(C, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
{ "spi0", 3 },
} },
{ SXIPIO_PIN(C, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
{ "spi0", 3 },
} },
{ SXIPIO_PIN(C, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
{ "spi0", 3 },
} },
{ SXIPIO_PIN(C, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
{ "spi0", 3 },
} },
{ SXIPIO_PIN(C, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 7), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 8), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 9), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(C, 10), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc2", 2 },
} },
{ SXIPIO_PIN(D, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 7), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 8), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 9), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 10), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 11), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 12), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 13), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 14), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 15), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 16), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 17), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
{ "emac", 4 },
} },
{ SXIPIO_PIN(D, 18), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
} },
{ SXIPIO_PIN(D, 19), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
} },
{ SXIPIO_PIN(D, 20), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
} },
{ SXIPIO_PIN(D, 21), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 2 },
{ "lvds", 3 },
} },
{ SXIPIO_PIN(E, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 7), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 8), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 9), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 10), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 11), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 12), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 13), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 14), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 15), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 16), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 17), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 18), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 19), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "lcd", 3 },
} },
{ SXIPIO_PIN(E, 20), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "csi_mipi", 3 },
} },
{ SXIPIO_PIN(E, 21), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "i2c1", 3 },
{ "uart1", 4 },
} },
{ SXIPIO_PIN(E, 22), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "csi", 2 },
{ "i2c1", 3 },
{ "uart1", 4 },
} },
{ SXIPIO_PIN(E, 23), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 3 },
{ "uart1", 4 },
} },
{ SXIPIO_PIN(E, 24), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "lcd", 3 },
{ "uart1", 4 },
} },
{ SXIPIO_PIN(F, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "jtag", 3 },
} },
{ SXIPIO_PIN(F, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "jtag", 3 },
} },
{ SXIPIO_PIN(F, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "uart0", 3 },
} },
{ SXIPIO_PIN(F, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "jtag", 3 },
} },
{ SXIPIO_PIN(F, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "uart0", 3 },
} },
{ SXIPIO_PIN(F, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc0", 2 },
{ "jtag", 3 },
} },
{ SXIPIO_PIN(F, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
} },
{ SXIPIO_PIN(G, 0), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 1), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 2), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 3), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 4), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 5), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "mmc1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 6), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 7), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 8), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 9), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "uart1", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 10), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2s", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 11), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2s", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 12), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2s", 2 },
{ "irq", 6 },
} },
{ SXIPIO_PIN(G, 13), {
{ "gpio_in", 0 },
{ "gpio_out", 1 },
{ "i2s", 2 },
{ "irq", 6 },
} },
};
const struct sxipio_pin sun8i_v3s_pins[] = { const struct sxipio_pin sun8i_v3s_pins[] = {
{ SXIPIO_PIN(B, 0), { { SXIPIO_PIN(B, 0), {
{ "gpio_in", 0 }, { "gpio_in", 0 },
@ -9768,12 +10330,14 @@ const struct sxipio_pin sun50i_h6_r_pins[] = {
{ SXIPIO_PIN(L, 0), { { SXIPIO_PIN(L, 0), {
{ "gpio_in", 0 }, { "gpio_in", 0 },
{ "gpio_out", 1 }, { "gpio_out", 1 },
{ "s_rsb", 2 },
{ "s_i2c", 3 }, { "s_i2c", 3 },
{ "irq", 6 }, { "irq", 6 },
} }, } },
{ SXIPIO_PIN(L, 1), { { SXIPIO_PIN(L, 1), {
{ "gpio_in", 0 }, { "gpio_in", 0 },
{ "gpio_out", 1 }, { "gpio_out", 1 },
{ "s_rsb", 2 },
{ "s_i2c", 3 }, { "s_i2c", 3 },
{ "irq", 6 }, { "irq", 6 },
} }, } },

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.110 2022/06/30 09:55:53 nicm Exp $ # $OpenBSD: Makefile,v 1.111 2023/09/01 14:29:11 nicm Exp $
PROG= tmux PROG= tmux
SRCS= alerts.c \ SRCS= alerts.c \
@ -121,6 +121,7 @@ SRCS= alerts.c \
tty-term.c \ tty-term.c \
tty.c \ tty.c \
utf8.c \ utf8.c \
utf8-combined.c \
window-buffer.c \ window-buffer.c \
window-client.c \ window-client.c \
window-clock.c \ window-clock.c \

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-capture-pane.c,v 1.59 2022/09/28 07:55:29 nicm Exp $ */ /* $OpenBSD: cmd-capture-pane.c,v 1.60 2023/09/01 16:40:38 nicm Exp $ */
/* /*
* Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@ -39,7 +39,7 @@ const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane", .name = "capture-pane",
.alias = "capturep", .alias = "capturep",
.args = { "ab:CeE:JNpPqS:t:", 0, 0, NULL }, .args = { "ab:CeE:JNpPqS:Tt:", 0, 0, NULL },
.usage = "[-aCeJNpPqT] " CMD_BUFFER_USAGE " [-E end-line] " .usage = "[-aCeJNpPqT] " CMD_BUFFER_USAGE " [-E end-line] "
"[-S start-line] " CMD_TARGET_PANE_USAGE, "[-S start-line] " CMD_TARGET_PANE_USAGE,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-new-window.c,v 1.96 2021/08/27 17:25:55 nicm Exp $ */ /* $OpenBSD: cmd-new-window.c,v 1.97 2023/09/01 14:24:46 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -60,7 +60,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
struct session *s = target->s; struct session *s = target->s;
struct winlink *wl = target->wl, *new_wl = NULL; struct winlink *wl = target->wl, *new_wl = NULL;
int idx = target->idx, before; int idx = target->idx, before;
char *cause = NULL, *cp; char *cause = NULL, *cp, *expanded;
const char *template, *name; const char *template, *name;
struct cmd_find_state fs; struct cmd_find_state fs;
struct args_value *av; struct args_value *av;
@ -71,16 +71,19 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
*/ */
name = args_get(args, 'n'); name = args_get(args, 'n');
if (args_has(args, 'S') && name != NULL && target->idx == -1) { if (args_has(args, 'S') && name != NULL && target->idx == -1) {
expanded = format_single(item, name, c, s, NULL, NULL);
RB_FOREACH(wl, winlinks, &s->windows) { RB_FOREACH(wl, winlinks, &s->windows) {
if (strcmp(wl->window->name, name) != 0) if (strcmp(wl->window->name, expanded) != 0)
continue; continue;
if (new_wl == NULL) { if (new_wl == NULL) {
new_wl = wl; new_wl = wl;
continue; continue;
} }
cmdq_error(item, "multiple windows named %s", name); cmdq_error(item, "multiple windows named %s", name);
free(expanded);
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
free(expanded);
if (new_wl != NULL) { if (new_wl != NULL) {
if (args_has(args, 'd')) if (args_has(args, 'd'))
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.167 2023/08/15 07:01:47 nicm Exp $ */ /* $OpenBSD: options-table.c,v 1.168 2023/09/01 13:48:54 nicm Exp $ */
/* /*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -86,7 +86,7 @@ static const char *options_table_remain_on_exit_list[] = {
"off", "on", "failed", NULL "off", "on", "failed", NULL
}; };
static const char *options_table_detach_on_destroy_list[] = { static const char *options_table_detach_on_destroy_list[] = {
"off", "on", "no-detached", NULL "off", "on", "no-detached", "previous", "next", NULL
}; };
static const char *options_table_extended_keys_list[] = { static const char *options_table_extended_keys_list[] = {
"off", "on", "always", NULL "off", "on", "always", NULL

View File

@ -1,4 +1,4 @@
/* $OpenBSD: screen-write.c,v 1.218 2023/08/15 07:01:47 nicm Exp $ */ /* $OpenBSD: screen-write.c,v 1.220 2023/09/01 16:01:54 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -1792,6 +1792,8 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
u_int sx = screen_size_x(s); u_int sx = screen_size_x(s);
int collect; int collect;
ctx->flags &= ~SCREEN_WRITE_COMBINE;
/* /*
* Don't need to check that the attributes and whatnot are still the * Don't need to check that the attributes and whatnot are still the
* same - input_parse will end the collection when anything that isn't * same - input_parse will end the collection when anything that isn't
@ -1840,46 +1842,37 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
{ {
struct screen *s = ctx->s; struct screen *s = ctx->s;
struct grid *gd = s->grid; struct grid *gd = s->grid;
const struct utf8_data *ud = &gc->data; struct grid_cell copy;
const struct utf8_data zwj = { "\342\200\215", 0, 3, 0 }; const struct utf8_data *ud = &gc->data, *previous = NULL, *combine;
struct grid_line *gl; struct grid_line *gl;
struct grid_cell_entry *gce; struct grid_cell_entry *gce;
struct grid_cell tmp_gc, now_gc; struct grid_cell tmp_gc, now_gc;
struct tty_ctx ttyctx; struct tty_ctx ttyctx;
u_int sx = screen_size_x(s), sy = screen_size_y(s); u_int sx = screen_size_x(s), sy = screen_size_y(s);
u_int width = gc->data.width, xx, last, cx, cy; u_int width = ud->width, xx, last, cx, cy;
int selected, skip = 1; int selected, skip = 1;
/* Ignore padding cells. */ /* Ignore padding cells. */
if (gc->flags & GRID_FLAG_PADDING) if (gc->flags & GRID_FLAG_PADDING)
return; return;
/* /* Check if this cell needs to be combined with the previous cell. */
* If this is a zero width joiner, set the flag so the next character if (ctx->flags & SCREEN_WRITE_COMBINE)
* will be treated as zero width and appended. Note that we assume a previous = &ctx->previous;
* ZWJ will not change the width - the width of the first character is switch (utf8_try_combined(ud, previous, &combine, &width)) {
* used. case UTF8_DISCARD_NOW:
*/ log_debug("%s: UTF8_DISCARD_NOW (width %u)", __func__, width);
if (ud->size == 3 && memcmp(ud->data, "\342\200\215", 3) == 0) { ctx->flags &= ~SCREEN_WRITE_COMBINE;
log_debug("zero width joiner at %u,%u", s->cx, s->cy);
ctx->flags |= SCREEN_WRITE_ZWJ;
return; return;
} case UTF8_WRITE_NOW:
log_debug("%s: UTF8_WRITE_NOW (width %u)", __func__, width);
/* ctx->flags &= ~SCREEN_WRITE_COMBINE;
* If the width is zero, combine onto the previous character. We always break;
* combine with the cell to the left of the cursor position. In theory, case UTF8_COMBINE_NOW:
* the application could have moved the cursor somewhere else, but if log_debug("%s: UTF8_COMBINE_NOW (width %u)", __func__, width);
* they are silly enough to do that, who cares?
*/
if (ctx->flags & SCREEN_WRITE_ZWJ) {
screen_write_collect_flush(ctx, 0, __func__); screen_write_collect_flush(ctx, 0, __func__);
screen_write_combine(ctx, &zwj, &xx, &cx); gc = screen_write_combine(ctx, combine, &xx, &cx);
} if (gc != NULL) {
if (width == 0 || (ctx->flags & SCREEN_WRITE_ZWJ)) {
ctx->flags &= ~SCREEN_WRITE_ZWJ;
screen_write_collect_flush(ctx, 0, __func__);
if ((gc = screen_write_combine(ctx, ud, &xx, &cx)) != NULL) {
cy = s->cy; cy = s->cy;
screen_write_set_cursor(ctx, xx, s->cy); screen_write_set_cursor(ctx, xx, s->cy);
screen_write_initctx(ctx, &ttyctx, 0); screen_write_initctx(ctx, &ttyctx, 0);
@ -1887,8 +1880,27 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
tty_write(tty_cmd_cell, &ttyctx); tty_write(tty_cmd_cell, &ttyctx);
s->cx = cx; s->cy = cy; s->cx = cx; s->cy = cy;
} }
ctx->flags &= ~SCREEN_WRITE_COMBINE;
return;
case UTF8_WRITE_MAYBE_COMBINE:
log_debug("%s: UTF8_WRITE_MAYBE_COMBINE (width %u)", __func__,
width);
utf8_copy(&ctx->previous, ud);
ctx->flags |= SCREEN_WRITE_COMBINE;
break;
case UTF8_DISCARD_MAYBE_COMBINE:
log_debug("%s: UTF8_DISCARD_MAYBE_COMBINE (width %u)", __func__,
width);
utf8_copy(&ctx->previous, ud);
ctx->flags |= SCREEN_WRITE_COMBINE;
return; return;
} }
if (width != ud->width) {
memcpy(&copy, gc, sizeof copy);
copy.data.width = width;
gc = &copy;
}
ud = NULL;
/* Flush any existing scrolling. */ /* Flush any existing scrolling. */
screen_write_collect_flush(ctx, 1, __func__); screen_write_collect_flush(ctx, 1, __func__);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: server-fn.c,v 1.133 2022/03/08 18:31:46 nicm Exp $ */ /* $OpenBSD: server-fn.c,v 1.134 2023/09/01 13:48:54 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -29,8 +29,7 @@
#include "tmux.h" #include "tmux.h"
static struct session *server_next_session(struct session *); static void server_destroy_session_group(struct session *);
static void server_destroy_session_group(struct session *);
void void
server_redraw_client(struct client *c) server_redraw_client(struct client *c)
@ -209,8 +208,8 @@ server_kill_window(struct window *w, int renumber)
if (session_detach(s, wl)) { if (session_detach(s, wl)) {
server_destroy_session_group(s); server_destroy_session_group(s);
break; break;
} else }
server_redraw_session_group(s); server_redraw_session_group(s);
} }
if (renumber) if (renumber)
@ -384,9 +383,10 @@ server_destroy_session_group(struct session *s)
struct session_group *sg; struct session_group *sg;
struct session *s1; struct session *s1;
if ((sg = session_group_contains(s)) == NULL) if ((sg = session_group_contains(s)) == NULL) {
server_destroy_session(s); server_destroy_session(s);
else { session_destroy(s, 1, __func__);
} else {
TAILQ_FOREACH_SAFE(s, &sg->sessions, gentry, s1) { TAILQ_FOREACH_SAFE(s, &sg->sessions, gentry, s1) {
server_destroy_session(s); server_destroy_session(s);
session_destroy(s, 1, __func__); session_destroy(s, 1, __func__);
@ -395,52 +395,55 @@ server_destroy_session_group(struct session *s)
} }
static struct session * static struct session *
server_next_session(struct session *s) server_find_session(struct session *s,
int (*f)(struct session *, struct session *))
{ {
struct session *s_loop, *s_out = NULL; struct session *s_loop, *s_out = NULL;
RB_FOREACH(s_loop, sessions, &sessions) { RB_FOREACH(s_loop, sessions, &sessions) {
if (s_loop == s) if (s_loop != s && (s_out == NULL || f(s_loop, s_out)))
continue;
if (s_out == NULL ||
timercmp(&s_loop->activity_time, &s_out->activity_time, <))
s_out = s_loop; s_out = s_loop;
} }
return (s_out); return (s_out);
} }
static struct session * static int
server_next_detached_session(struct session *s) server_newer_session(struct session *s_loop, struct session *s_out)
{ {
struct session *s_loop, *s_out = NULL; return (timercmp(&s_loop->activity_time, &s_out->activity_time, <));
}
RB_FOREACH(s_loop, sessions, &sessions) { static int
if (s_loop == s || s_loop->attached) server_newer_detached_session(struct session *s_loop, struct session *s_out)
continue; {
if (s_out == NULL || if (s_loop->attached)
timercmp(&s_loop->activity_time, &s_out->activity_time, <)) return (0);
s_out = s_loop; return (server_newer_session(s_loop, s_out));
}
return (s_out);
} }
void void
server_destroy_session(struct session *s) server_destroy_session(struct session *s)
{ {
struct client *c; struct client *c;
struct session *s_new; struct session *s_new = NULL;
int detach_on_destroy; int detach_on_destroy;
detach_on_destroy = options_get_number(s->options, "detach-on-destroy"); detach_on_destroy = options_get_number(s->options, "detach-on-destroy");
if (detach_on_destroy == 0) if (detach_on_destroy == 0)
s_new = server_next_session(s); s_new = server_find_session(s, server_newer_session);
else if (detach_on_destroy == 2) else if (detach_on_destroy == 2)
s_new = server_next_detached_session(s); s_new = server_find_session(s, server_newer_detached_session);
else else if (detach_on_destroy == 3)
s_new = session_previous_session(s);
else if (detach_on_destroy == 4)
s_new = session_next_session(s);
if (s_new == s)
s_new = NULL; s_new = NULL;
TAILQ_FOREACH(c, &clients, entry) { TAILQ_FOREACH(c, &clients, entry) {
if (c->session != s) if (c->session != s)
continue; continue;
c->session = NULL;
c->last_session = NULL;
server_client_set_session(c, s_new); server_client_set_session(c, s_new);
if (s_new == NULL) if (s_new == NULL)
c->flags |= CLIENT_EXIT; c->flags |= CLIENT_EXIT;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: server.c,v 1.203 2022/06/30 09:55:53 nicm Exp $ */ /* $OpenBSD: server.c,v 1.204 2023/09/01 14:29:11 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -205,6 +205,7 @@ server_start(struct tmuxproc *client, int flags, struct event_base *base,
fatal("pledge failed"); fatal("pledge failed");
input_key_build(); input_key_build();
utf8_build_combined();
RB_INIT(&windows); RB_INIT(&windows);
RB_INIT(&all_window_panes); RB_INIT(&all_window_panes);
TAILQ_INIT(&clients); TAILQ_INIT(&clients);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.94 2023/07/19 13:03:36 nicm Exp $ */ /* $OpenBSD: session.c,v 1.95 2023/09/01 13:48:54 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -367,11 +367,9 @@ session_detach(struct session *s, struct winlink *wl)
session_group_synchronize_from(s); session_group_synchronize_from(s);
if (RB_EMPTY(&s->windows)) { if (RB_EMPTY(&s->windows))
session_destroy(s, 1, __func__);
return (1); return (1);
} return (0);
return (0);
} }
/* Return if session has window. */ /* Return if session has window. */

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.929 2023/08/23 08:40:25 nicm Exp $ .\" $OpenBSD: tmux.1,v 1.930 2023/09/01 13:48:54 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: August 23 2023 $ .Dd $Mdocdate: September 1 2023 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@ -4039,16 +4039,25 @@ The default is 80x24.
If enabled and the session is no longer attached to any clients, it is If enabled and the session is no longer attached to any clients, it is
destroyed. destroyed.
.It Xo Ic detach-on-destroy .It Xo Ic detach-on-destroy
.Op Ic off | on | no-detached .Op Ic off | on | no-detached | previous | next
.Xc .Xc
If on (the default), the client is detached when the session it is attached to If
.Ic on
(the default), the client is detached when the session it is attached to
is destroyed. is destroyed.
If off, the client is switched to the most recently active of the remaining If
.Ic off ,
the client is switched to the most recently active of the remaining
sessions. sessions.
If If
.Ic no-detached , .Ic no-detached ,
the client is detached only if there are no detached sessions; if detached the client is detached only if there are no detached sessions; if detached
sessions exist, the client is switched to the most recently active. sessions exist, the client is switched to the most recently active.
If
.Ic previous
or
.Ic next ,
the client is switched to the previous or next session in alphabetical order.
.It Ic display-panes-active-colour Ar colour .It Ic display-panes-active-colour Ar colour
Set the colour used by the Set the colour used by the
.Ic display-panes .Ic display-panes

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1206 2023/08/17 14:10:28 nicm Exp $ */ /* $OpenBSD: tmux.h,v 1.1207 2023/09/01 14:29:11 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -618,6 +618,15 @@ enum utf8_state {
UTF8_ERROR UTF8_ERROR
}; };
/* UTF-8 combine state. */
enum utf8_combine_state {
UTF8_DISCARD_NOW, /* discard immediately */
UTF8_WRITE_NOW, /* do not combine, write immediately */
UTF8_COMBINE_NOW, /* combine immediately */
UTF8_WRITE_MAYBE_COMBINE, /* write but try to combine the next */
UTF8_DISCARD_MAYBE_COMBINE /* discard but try to combine the next */
};
/* Colour flags. */ /* Colour flags. */
#define COLOUR_FLAG_256 0x01000000 #define COLOUR_FLAG_256 0x01000000
#define COLOUR_FLAG_RGB 0x02000000 #define COLOUR_FLAG_RGB 0x02000000
@ -890,7 +899,7 @@ struct screen_write_ctx {
int flags; int flags;
#define SCREEN_WRITE_SYNC 0x1 #define SCREEN_WRITE_SYNC 0x1
#define SCREEN_WRITE_ZWJ 0x2 #define SCREEN_WRITE_COMBINE 0x2
screen_write_init_ctx_cb init_ctx_cb; screen_write_init_ctx_cb init_ctx_cb;
void *arg; void *arg;
@ -898,6 +907,7 @@ struct screen_write_ctx {
struct screen_write_citem *item; struct screen_write_citem *item;
u_int scrolled; u_int scrolled;
u_int bg; u_int bg;
struct utf8_data previous;
}; };
/* Box border lines option. */ /* Box border lines option. */
@ -3285,6 +3295,12 @@ char *utf8_padcstr(const char *, u_int);
char *utf8_rpadcstr(const char *, u_int); char *utf8_rpadcstr(const char *, u_int);
int utf8_cstrhas(const char *, const struct utf8_data *); int utf8_cstrhas(const char *, const struct utf8_data *);
/* utf8-combined.c */
void utf8_build_combined(void);
int utf8_try_combined(const struct utf8_data *,
const struct utf8_data *, const struct utf8_data **,
u_int *width);
/* procname.c */ /* procname.c */
char *get_proc_name(int, char *); char *get_proc_name(int, char *);
char *get_proc_cwd(int); char *get_proc_cwd(int);

1135
usr.bin/tmux/utf8-combined.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $OpenBSD: utf8.c,v 1.62 2023/07/03 08:37:14 nicm Exp $ */ /* $OpenBSD: utf8.c,v 1.63 2023/09/01 14:29:11 nicm Exp $ */
/* /*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -136,8 +136,8 @@ utf8_from_data(const struct utf8_data *ud, utf8_char *uc)
goto fail; goto fail;
if (ud->size <= 3) { if (ud->size <= 3) {
index = (((utf8_char)ud->data[2] << 16)| index = (((utf8_char)ud->data[2] << 16)|
((utf8_char)ud->data[1] << 8)| ((utf8_char)ud->data[1] << 8)|
((utf8_char)ud->data[0])); ((utf8_char)ud->data[0]));
} else if (utf8_put_item(ud->data, ud->size, &index) != 0) } else if (utf8_put_item(ud->data, ud->size, &index) != 0)
goto fail; goto fail;
*uc = UTF8_SET_SIZE(ud->size)|UTF8_SET_WIDTH(ud->width)|index; *uc = UTF8_SET_SIZE(ud->size)|UTF8_SET_WIDTH(ud->width)|index;
@ -226,9 +226,9 @@ utf8_width(struct utf8_data *ud, int *width)
case 0: case 0:
return (UTF8_ERROR); return (UTF8_ERROR);
} }
log_debug("UTF-8 %.*s is %08X", (int)ud->size, ud->data, (u_int)wc); log_debug("UTF-8 %.*s is %05X", (int)ud->size, ud->data, (u_int)wc);
*width = wcwidth(wc); *width = wcwidth(wc);
log_debug("wcwidth(%08X) returned %d", (u_int)wc, *width); log_debug("wcwidth(%05X) returned %d", (u_int)wc, *width);
if (*width < 0) { if (*width < 0) {
/* /*
* C1 control characters are nonprintable, so they are always * C1 control characters are nonprintable, so they are always

View File

@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.342 2023/08/08 08:21:30 nicm Exp $ */ /* $OpenBSD: window-copy.c,v 1.343 2023/09/01 14:29:11 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -3763,8 +3763,7 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex)
} }
} }
endline = gd->hsize + gd->sy - 1; endline = gd->hsize + gd->sy - 1;
} } else {
else {
window_copy_move_left(s, &fx, &fy, wrapflag); window_copy_move_left(s, &fx, &fy, wrapflag);
endline = 0; endline = 0;
} }
@ -3806,8 +3805,7 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex)
data->cy = fy - screen_hsize(data->backing) + data->cy = fy - screen_hsize(data->backing) +
data-> oy; data-> oy;
} }
} } else {
else {
/* /*
* When searching backward, position the cursor at the * When searching backward, position the cursor at the
* beginning of the mark. * beginning of the mark.