Merge branch 'master' into floating_panes

This commit is contained in:
Michael Grant
2026-03-20 08:05:13 +00:00
4 changed files with 83 additions and 23 deletions

View File

@@ -81,7 +81,8 @@ struct systemd_job_watch {
}; };
static int static int
job_removed_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) job_removed_handler(sd_bus_message *m, void *userdata,
__unused sd_bus_error *ret_error)
{ {
struct systemd_job_watch *watch = userdata; struct systemd_job_watch *watch = userdata;
const char *path = NULL; const char *path = NULL;
@@ -109,7 +110,7 @@ systemd_move_to_new_cgroup(char **cause)
sd_bus_message *m = NULL, *reply = NULL; sd_bus_message *m = NULL, *reply = NULL;
sd_bus *bus = NULL; sd_bus *bus = NULL;
sd_bus_slot *slot = NULL; sd_bus_slot *slot = NULL;
char *name, *desc, *slice; char *name, *desc, *slice, *unit;
sd_id128_t uuid; sd_id128_t uuid;
int r; int r;
uint64_t elapsed_usec; uint64_t elapsed_usec;
@@ -241,6 +242,26 @@ systemd_move_to_new_cgroup(char **cause)
goto finish; goto finish;
} }
/*
* Try locating systemd unit that started the server, and mark pane units
* as dependent on it. Use "Before" to make sure systemd will not try to
* kill them first.
*/
if (sd_pid_get_user_unit(parent_pid, &unit) == 0 ||
sd_pid_get_unit(parent_pid, &unit) == 0) {
r = sd_bus_message_append(m, "(sv)", "Before", "as", 1, unit);
if (r >= 0) {
r = sd_bus_message_append(m, "(sv)", "PartOf", "as", 1,
unit);
}
free(unit);
if (r < 0) {
xasprintf(cause, "failed to append to properties: %s",
strerror(-r));
goto finish;
}
}
/* End properties array. */ /* End properties array. */
r = sd_bus_message_close_container(m); r = sd_bus_message_close_container(m);
if (r < 0) { if (r < 0) {

View File

@@ -279,6 +279,10 @@ popup_draw_cb(struct client *c, void *data, struct screen_redraw_ctx *rctx)
popup_reapply_styles(pd); popup_reapply_styles(pd);
screen_init(&s, pd->sx, pd->sy, 0); screen_init(&s, pd->sx, pd->sy, 0);
if (pd->s.hyperlinks != NULL) {
hyperlinks_free(s.hyperlinks);
s.hyperlinks = hyperlinks_copy(pd->s.hyperlinks);
}
screen_write_start(&ctx, &s); screen_write_start(&ctx, &s);
screen_write_clearscreen(&ctx, 8); screen_write_clearscreen(&ctx, 8);

7
tmux.1
View File

@@ -4241,9 +4241,10 @@ An array option allowing widths of Unicode codepoints to be overridden.
Note the new width applies to all clients. Note the new width applies to all clients.
Each entry is of the form Each entry is of the form
.Em codepoint=width , .Em codepoint=width ,
where codepoint may be a UTF-8 character or an identifier of the form where codepoint may be a UTF-8 character, an identifier of the form
.Ql U+number .Ql U+number
where the number is a hexadecimal number. where the number is a hexadecimal number, or a range of the form
.Ql U+number-U+number .
.It Ic copy-command Ar shell-command .It Ic copy-command Ar shell-command
Give the command to pipe to if the Give the command to pipe to if the
.Ic copy-pipe .Ic copy-pipe
@@ -4366,7 +4367,7 @@ causes
.Nm .Nm
to request the clipboard from the most recently used client (if possible) and to request the clipboard from the most recently used client (if possible) and
send the reply (if any) back to the application; send the reply (if any) back to the application;
.Ic buffer .Ic both
is the same as is the same as
.Ic request .Ic request
but also creates a paste buffer. but also creates a paste buffer.

70
utf8.c
View File

@@ -292,16 +292,37 @@ utf8_find_in_width_cache(wchar_t wc)
return RB_FIND(utf8_width_cache, &utf8_width_cache, &uw); return RB_FIND(utf8_width_cache, &utf8_width_cache, &uw);
} }
/* Add to width cache. */
static void
utf8_insert_width_cache(wchar_t wc, u_int width)
{
struct utf8_width_item *uw, *old;
log_debug("Unicode width cache: %08X=%u", (u_int)wc, width);
uw = xcalloc(1, sizeof *uw);
uw->wc = wc;
uw->width = width;
uw->allocated = 1;
old = RB_INSERT(utf8_width_cache, &utf8_width_cache, uw);
if (old != NULL) {
RB_REMOVE(utf8_width_cache, &utf8_width_cache, old);
if (old->allocated)
free(old);
RB_INSERT(utf8_width_cache, &utf8_width_cache, uw);
}
}
/* Parse a single codepoint option. */ /* Parse a single codepoint option. */
static void static void
utf8_add_to_width_cache(const char *s) utf8_add_to_width_cache(const char *s)
{ {
struct utf8_width_item *uw, *old;
char *copy, *cp, *endptr; char *copy, *cp, *endptr;
u_int width; u_int width;
const char *errstr; const char *errstr;
struct utf8_data *ud; struct utf8_data *ud;
wchar_t wc; wchar_t wc, wc_start, wc_end;
unsigned long long n; unsigned long long n;
copy = xstrdup(s); copy = xstrdup(s);
@@ -321,14 +342,40 @@ utf8_add_to_width_cache(const char *s)
errno = 0; errno = 0;
n = strtoull(copy + 2, &endptr, 16); n = strtoull(copy + 2, &endptr, 16);
if (copy[2] == '\0' || if (copy[2] == '\0' ||
*endptr != '\0' ||
n == 0 || n == 0 ||
n > WCHAR_MAX || n > WCHAR_MAX ||
(errno == ERANGE && n == ULLONG_MAX)) { (errno == ERANGE && n == ULLONG_MAX)) {
free(copy); free(copy);
return; return;
} }
wc = n; wc_start = n;
if (*endptr == '-') {
endptr++;
if (strncmp(endptr, "U+", 2) != 0) {
free(copy);
return;
}
errno = 0;
n = strtoull(endptr + 2, &endptr, 16);
if (*endptr != '\0' ||
n == 0 ||
n > WCHAR_MAX ||
(errno == ERANGE && n == ULLONG_MAX) ||
(wchar_t)n < wc_start) {
free(copy);
return;
}
wc_end = n;
} else {
if (*endptr != '\0') {
free(copy);
return;
}
wc_end = wc_start;
}
for (wc = wc_start; wc <= wc_end; wc++)
utf8_insert_width_cache(wc, width);
} else { } else {
utf8_no_width = 1; utf8_no_width = 1;
ud = utf8_fromcstr(copy); ud = utf8_fromcstr(copy);
@@ -348,21 +395,8 @@ utf8_add_to_width_cache(const char *s)
return; return;
} }
free(ud); free(ud);
}
log_debug("Unicode width cache: %08X=%u", (u_int)wc, width); utf8_insert_width_cache(wc, width);
uw = xcalloc(1, sizeof *uw);
uw->wc = wc;
uw->width = width;
uw->allocated = 1;
old = RB_INSERT(utf8_width_cache, &utf8_width_cache, uw);
if (old != NULL) {
RB_REMOVE(utf8_width_cache, &utf8_width_cache, old);
if (old->allocated)
free(old);
RB_INSERT(utf8_width_cache, &utf8_width_cache, uw);
} }
free(copy); free(copy);