Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-13 10:15:06 +01:00
5 changed files with 22 additions and 28 deletions

View File

@@ -189,10 +189,11 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
} }
if (args_has(args, 'k') || args_has(args, 'm')) { if (args_has(args, 'k') || args_has(args, 'm')) {
options_set_number(new_wp->options, "remain-on-exit", 3); options_set_number(new_wp->options, "remain-on-exit", 3);
if (args_has(args, 'm')) if (args_has(args, 'm')) {
options_set_string(new_wp->options, options_set_string(new_wp->options,
"remain-on-exit-format", "remain-on-exit-format", 0, "%s",
0, "%s", args_get(args, 'm')); args_get(args, 'm'));
}
} }
if (args_has(args, 'T')) { if (args_has(args, 'T')) {
title = format_single_from_target(item, args_get(args, 'T')); title = format_single_from_target(item, args_get(args, 'T'));

View File

@@ -4070,18 +4070,14 @@ format_relative_time(time_t t)
{ {
time_t now, age; time_t now, age;
u_int d, h, m, s; u_int d, h, m, s;
char out[32], sign; char out[32];
time(&now); time(&now);
if (t > now)
return (NULL);
if (t == now) if (t == now)
return (xstrdup("0s")); return (xstrdup("0s"));
if (t > now) { age = now - t;
sign = '+';
age = t - now;
} else {
sign = '-';
age = now - t;
}
d = age / 86400; d = age / 86400;
h = (age % 86400) / 3600; h = (age % 86400) / 3600;
@@ -4090,21 +4086,21 @@ format_relative_time(time_t t)
if (d != 0) { if (d != 0) {
if (h != 0) if (h != 0)
xsnprintf(out, sizeof out, "%c%ud%uh", sign, d, h); xsnprintf(out, sizeof out, "%ud%uh", d, h);
else else
xsnprintf(out, sizeof out, "%c%ud", sign, d); xsnprintf(out, sizeof out, "%ud", d);
} else if (h != 0) { } else if (h != 0) {
if (m != 0) if (m != 0)
xsnprintf(out, sizeof out, "%c%uh%um", sign, h, m); xsnprintf(out, sizeof out, "%uh%um", h, m);
else else
xsnprintf(out, sizeof out, "%c%uh", sign, h); xsnprintf(out, sizeof out, "%uh", h);
} else if (m != 0) { } else if (m != 0) {
if (s != 0) if (s != 0)
xsnprintf(out, sizeof out, "%c%um%us", sign, m, s); xsnprintf(out, sizeof out, "%um%us", m, s);
else else
xsnprintf(out, sizeof out, "%c%um", sign, m); xsnprintf(out, sizeof out, "%um", m);
} else } else
xsnprintf(out, sizeof out, "%c%us", sign, s); xsnprintf(out, sizeof out, "%us", s);
return (xstrdup(out)); return (xstrdup(out));
} }
@@ -5201,7 +5197,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
else if (fm->argc >= 2 && else if (fm->argc >= 2 &&
strchr(fm->argv[0], 'f') != NULL) { strchr(fm->argv[0], 'f') != NULL) {
free(time_format); free(time_format);
time_format = format_strip(es, fm->argv[1]); time_format = format_strip(es,
fm->argv[1]);
} }
break; break;
case 'q': case 'q':

4
tmux.1
View File

@@ -6412,9 +6412,9 @@ will use shorter but less accurate time format for times in the past.
.Ql r .Ql r
.Pq Ql t/r .Pq Ql t/r
will show the time relative to the current time, for example will show the time relative to the current time, for example
.Ql \-1m .Ql \1m
or or
.Ql +2m23s . .Ql 2m23s .
A custom format may be given using an A custom format may be given using an
.Ql f .Ql f
suffix (note that suffix (note that

View File

@@ -175,7 +175,7 @@ window_clock_init(struct window_mode_entry *wme,
struct window_clock_mode_data *data; struct window_clock_mode_data *data;
struct screen *s; struct screen *s;
wme->data = data = xmalloc(sizeof *data); wme->data = data = xcalloc(1, sizeof *data);
data->tim = time(NULL); data->tim = time(NULL);
evtimer_set(&data->timer, window_clock_timer_callback, wme); evtimer_set(&data->timer, window_clock_timer_callback, wme);

View File

@@ -5102,14 +5102,10 @@ window_copy_set_line_numbers(struct window_pane *wp, int enabled)
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes); struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
struct window_copy_mode_data *data; struct window_copy_mode_data *data;
if (wme == NULL) if (wme == NULL || wme->mode != &window_copy_mode)
return;
if (wme->mode != &window_copy_mode)
return; return;
data = wme->data; data = wme->data;
if (data == NULL) if (data == NULL || data->line_numbers == enabled)
return;
if (data->line_numbers == enabled)
return; return;
data->line_numbers = enabled; data->line_numbers = enabled;
window_copy_redraw_screen(wme); window_copy_redraw_screen(wme);