Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'

* refs/remotes/tmux-openbsd/master:
  Use session IDs instead of session names to handle empty names, GitHub issue 5759 from jsistsir at gmail dot com.
  Instead of overwriting wide characters manually when combining, use the normal cell write path. Fixes problems with overlapping wide characters and those close to the last column.
  Always set the flag since we will never get a response.
  Add a key and flag for Kitty graphics.
  Some minor tidying.
This commit is contained in:
tmux update bot committed 2026-10-16 18:25:14 +00:00
commit 6e157ce997
8 files changed
+100 -67

No files matched your search

+4 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-new-session.c,v 1.154 2026/10/12 07:52:05 nicm Exp $ */
/* $OpenBSD: cmd-new-session.c,v 1.155 2026/10/16 17:28:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -128,10 +128,12 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
else
as = target->s;
if (as != NULL) {
retval = cmd_attach_session(item, as->name,
xasprintf(&cp, "$%u", as->id);
retval = cmd_attach_session(item, cp,
args_has(args, 'D'), args_has(args, 'X'), 0,
args_get(args, 'c'), args_has(args, 'E'),
args_get(args, 'f'));
free(cp);
free(wname);
free(sname);
return (retval);
+57 -34
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: screen-write.c,v 1.303 2026/10/16 11:33:44 nicm Exp $ */
/* $OpenBSD: screen-write.c,v 1.304 2026/10/16 17:21:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2779,9 +2779,10 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
ctx->s->write_list[s->cy].data[s->cx + ci->used++] = gc->data.data[0];
}
/* Write cell data. */
void
screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Write a cell, replacing any columns already written for its base. */
static void
screen_write_cell1(struct screen_write_ctx *ctx, const struct grid_cell *gc,
u_int old_width)
{
struct screen *s = ctx->s;
struct window_pane *wp = ctx->wp;
@@ -2793,17 +2794,14 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
struct tty_ctx ttyctx;
u_int sx = screen_size_x(s), sy = screen_size_y(s);
u_int width = ud->width, xx, not_wrap, i, n, vis;
u_int insert_width = width;
int selected, skip = 1, redraw = 0;
int yoff = 0, xoff = 0;
struct visible_ranges *r;
struct visible_range *ri;
/* Ignore padding cells. */
if (gc->flags & GRID_FLAG_PADDING)
return;
/* Get the previous cell to check for combining. */
if (screen_write_combine(ctx, gc) != 0)
/* If this character is wider than the screen, ignore it. */
if (width > sx)
return;
/* Flush any existing scrolling. */
@@ -2812,14 +2810,13 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* If this character doesn't fit, ignore it. */
if ((~s->mode & MODE_WRAP) &&
width > 1 &&
(width > sx || (s->cx != sx && s->cx > sx - width)))
s->cx != sx &&
s->cx > sx - width)
return;
/* If in insert mode, make space for the cells. */
if (s->mode & MODE_INSERT) {
grid_view_insert_cells(s->grid, s->cx, s->cy, width, 8);
skip = 0;
}
/* Do not insert again for columns already written on this line. */
if (s->cx <= sx - width)
insert_width -= old_width;
/* Check this will fit on the current line and wrap if not. */
if ((s->mode & MODE_WRAP) && s->cx > sx - width) {
@@ -2832,7 +2829,16 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Sanity check cursor position. */
if (s->cx > sx - width || s->cy > sy - 1)
return;
/* If in insert mode, make space for the new columns. */
if ((s->mode & MODE_INSERT) && insert_width != 0) {
grid_view_insert_cells(s->grid, s->cx + width - insert_width,
s->cy, insert_width, 8);
skip = 0;
}
screen_write_initctx(ctx, &ttyctx, 0, 0);
if (old_width != 0)
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
#ifdef ENABLE_IMAGES
/* Mark images as damaged. */
@@ -2911,22 +2917,24 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
* replace it.
*/
not_wrap = !(s->mode & MODE_WRAP);
if (s->cx <= sx - not_wrap - width)
if (width <= sx - not_wrap && s->cx <= sx - not_wrap - width)
screen_write_set_cursor(ctx, s->cx + width, -1);
else
screen_write_set_cursor(ctx, sx - not_wrap, -1);
/* Create space for character in insert mode. */
if (s->mode & MODE_INSERT) {
if ((s->mode & MODE_INSERT) && insert_width != 0) {
screen_write_collect_flush(ctx, 0, __func__);
if (wp != NULL && screen_write_pane_is_obscured(ctx)) {
if (screen_write_should_draw_line(ctx, s->cy))
screen_write_redraw_line(ctx, &ttyctx, s->cy);
return;
}
ttyctx.n = width;
ttyctx.ocx += width - insert_width;
ttyctx.n = insert_width;
if (screen_write_should_draw_line(ctx, s->cy))
tty_write(tty_cmd_insertcharacter, &ttyctx);
ttyctx.ocx -= width - insert_width;
}
/* If not writing, done now. */
@@ -2973,6 +2981,17 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
}
}
/* Write cell data. */
void
screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
{
if (gc->flags & GRID_FLAG_PADDING)
return;
if (screen_write_combine(ctx, gc) != 0)
return;
screen_write_cell1(ctx, gc, 0);
}
/* Combine a UTF-8 zero-width character onto the previous if necessary. */
static int
screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
@@ -2983,7 +3002,8 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
const struct utf8_data *ud = &gc->data;
struct options *oo = global_options;
u_int i, n, cx = s->cx, cy = s->cy, vis;
struct grid_cell last;
u_int sx = screen_size_x(s);
struct grid_cell last, tmp_gc;
struct tty_ctx ttyctx;
int force_wide = 0, zero_width = 0;
int xoff = 0, yoff = 0;
@@ -3064,11 +3084,23 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Force the width to 2 for modifiers and variation selector. */
if (last.data.width == 1 && force_wide) {
if (sx < 2 || (cx == sx && (~s->mode & MODE_WRAP)))
return (1);
last.data.width = 2;
n = 2;
cx++;
} else
force_wide = 0;
/* Clear the old character before moving to the next line. */
if (cx == sx) {
memcpy(&tmp_gc, &last, sizeof tmp_gc);
utf8_set(&tmp_gc.data, ' ');
screen_write_set_cursor(ctx, cx - 1, cy);
screen_write_cell1(ctx, &tmp_gc, 1);
}
/* Write through the normal path. */
screen_write_set_cursor(ctx, cx - 1, cy);
screen_write_cell1(ctx, &last, 1);
return (1);
}
#ifdef ENABLE_IMAGES
/* Mark images as damaged. */
@@ -3077,8 +3109,6 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Set the new cell. */
grid_view_set_cell(gd, cx - n, cy, &last);
if (force_wide)
grid_view_set_padding(gd, cx - 1, cy, last.bg);
/*
* Check if all of this character is visible. No character will be
@@ -3100,17 +3130,10 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
return (1);
}
/*
* Redraw the combined cell. If forcing the cell to width 2, reset the
* cached cursor position in the tty, since we don't really know
* whether the terminal thought the character was width 1 or width 2
* and what it is going to do now.
*/
/* Redraw the combined cell. */
screen_write_set_cursor(ctx, cx - n, cy);
screen_write_initctx(ctx, &ttyctx, 0, 0);
ttyctx.cell = &last;
if (force_wide)
ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
if (screen_write_should_draw_line(ctx, cy))
tty_write(tty_cmd_cell, &ttyctx);
screen_write_set_cursor(ctx, cx, cy);
+2 -2
View File
@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1189 2026/10/16 08:11:03 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.1190 2026/10/16 16:49:13 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -5222,7 +5222,7 @@ and use the
.Nm
internal set only.
.It kittygraphics
Supports the Kitty graphics protocol with Unicode placeholders.
Supports the Kitty graphics protocol.
.It margins
Supports DECSLRM margins.
.It mouse
+4 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1465 2026/10/16 07:59:06 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1466 2026/10/16 16:51:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -416,6 +416,7 @@ enum {
/* Terminal replies, handled in tty-keys.c and never fired. */
KEYC_REPORT_CLIPBOARD,
KEYC_REPORT_SYNC,
KEYC_REPORT_KITTY_GRAPHICS,
KEYC_REPORT_DA,
KEYC_REPORT_DA2,
KEYC_REPORT_XDA,
@@ -1840,8 +1841,9 @@ struct tty {
#define TTY_WAITBG 0x4000
#define TTY_BRACKETPASTE 0x8000
#define TTY_HAVESYNC 0x10000
#define TTY_HAVEKITTYGRAPHICS 0x20000
#define TTY_ALL_REQUEST_FLAGS \
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVESYNC)
(TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVESYNC|TTY_HAVEKITTYGRAPHICS)
int flags;
struct tty_term *term;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tty-features.c,v 1.50 2026/10/14 13:36:37 nicm Exp $ */
/* $OpenBSD: tty-features.c,v 1.51 2026/10/16 16:49:13 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -369,7 +369,7 @@ static const struct tty_feature tty_feature_sixel = {
TERM_SIXEL
};
/* Terminal supports Kitty graphics Unicode placeholders. */
/* Terminal supports the Kitty graphics protocol. */
static const struct tty_feature tty_feature_kittygraphics = {
"kittygraphics",
NULL,
+24 -18
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tty.c,v 1.492 2026/10/16 11:34:49 bket Exp $ */
/* $OpenBSD: tty.c,v 1.494 2026/10/16 16:56:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -390,11 +390,8 @@ tty_start_tty(struct tty *tty)
}
if (tty_term_has(tty->term, TTYC_ENBP))
tty_putcode(tty, TTYC_ENBP);
if (tty->term->flags & TERM_VT100LIKE) {
/* Subscribe to theme changes and request theme now. */
if (tty->term->flags & TERM_VT100LIKE)
tty_puts(tty, "\033[?2031h\033[?996n");
}
tty_start_start_timer(tty);
@@ -412,22 +409,31 @@ tty_start_tty(struct tty *tty)
void
tty_send_requests(struct tty *tty)
{
if (~tty->flags & TTY_STARTED)
struct tty_term *term = tty->term;
int flags = tty->flags;
if (~flags & TTY_STARTED)
return;
if (tty->term->flags & TERM_VT100LIKE) {
if (~tty->flags & TTY_HAVEDA)
tty_puts(tty, "\033[c");
if (~tty->flags & TTY_HAVEDA2)
tty_puts(tty, "\033[>c");
if (~tty->flags & TTY_HAVEXDA)
tty_puts(tty, "\033[>q");
if (~tty->flags & TTY_HAVESYNC)
tty_puts(tty, "\033[?2026$p");
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
} else
if (~term->flags & TERM_VT100LIKE) {
tty->flags |= TTY_ALL_REQUEST_FLAGS;
tty->last_requests = time(NULL);
return;
}
if (~flags & TTY_HAVEDA)
tty_puts(tty, "\033[c");
if (~flags & TTY_HAVEDA2)
tty_puts(tty, "\033[>c");
if (~flags & TTY_HAVEXDA)
tty_puts(tty, "\033[>q");
if (~flags & TTY_HAVESYNC)
tty_puts(tty, "\033[?2026$p");
tty->flags |= TTY_HAVEKITTYGRAPHICS;
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
tty->last_requests = time(NULL);
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: window-switch.c,v 1.6 2026/10/15 08:07:17 nicm Exp $ */
/* $OpenBSD: window-switch.c,v 1.7 2026/10/16 17:28:19 nicm Exp $ */
/*
* Copyright (c) 2026 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -530,7 +530,7 @@ window_switch_run_command(struct window_switch_modedata *data, struct client *c)
case WINDOW_SWITCH_TYPE_SESSION:
s = session_find_by_id(item->session);
if (s != NULL) {
xasprintf(&target, "=%s:", s->name);
xasprintf(&target, "$%u:", s->id);
cmd_find_from_session(&fs, s, 0);
}
break;
@@ -539,7 +539,7 @@ window_switch_run_command(struct window_switch_modedata *data, struct client *c)
if (s != NULL) {
wl = winlink_find_by_index(&s->windows, item->winlink);
if (s != NULL && wl != NULL) {
xasprintf(&target, "=%s:%u.", s->name, wl->idx);
xasprintf(&target, "$%u:%u.", s->id, wl->idx);
cmd_find_from_winlink(&fs, wl, 0);
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: window-tree.c,v 1.97 2026/10/12 18:23:25 nicm Exp $ */
/* $OpenBSD: window-tree.c,v 1.98 2026/10/16 17:28:19 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1224,17 +1224,17 @@ window_tree_get_target(struct window_tree_itemdata *item,
case WINDOW_TREE_SESSION:
if (s == NULL)
break;
xasprintf(&target, "=%s:", s->name);
xasprintf(&target, "$%u:", s->id);
break;
case WINDOW_TREE_WINDOW:
if (s == NULL || wl == NULL)
break;
xasprintf(&target, "=%s:%u.", s->name, wl->idx);
xasprintf(&target, "$%u:%u.", s->id, wl->idx);
break;
case WINDOW_TREE_PANE:
if (s == NULL || wl == NULL || wp == NULL)
break;
xasprintf(&target, "=%s:%u.%%%u", s->name, wl->idx, wp->id);
xasprintf(&target, "$%u:%u.%%%u", s->id, wl->idx, wp->id);
break;
}
if (target == NULL)