mirror of
https://github.com/openbsd/src.git
synced 2026-06-17 23:03:29 +02:00
Change relative time for now to only work in the past and not show a
sign which is more useful. Also tidy up some minor style nits.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-split-window.c,v 1.131 2026/06/10 16:03:14 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-split-window.c,v 1.132 2026/06/13 08:59:52 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -190,10 +190,11 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
||||
}
|
||||
if (args_has(args, 'k') || args_has(args, 'm')) {
|
||||
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,
|
||||
"remain-on-exit-format",
|
||||
0, "%s", args_get(args, 'm'));
|
||||
"remain-on-exit-format", 0, "%s",
|
||||
args_get(args, 'm'));
|
||||
}
|
||||
}
|
||||
if (args_has(args, 'T')) {
|
||||
title = format_single_from_target(item, args_get(args, 'T'));
|
||||
|
||||
+14
-17
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: format.c,v 1.374 2026/06/08 21:19:52 nicm Exp $ */
|
||||
/* $OpenBSD: format.c,v 1.375 2026/06/13 08:59:52 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -4052,18 +4052,14 @@ format_relative_time(time_t t)
|
||||
{
|
||||
time_t now, age;
|
||||
u_int d, h, m, s;
|
||||
char out[32], sign;
|
||||
char out[32];
|
||||
|
||||
time(&now);
|
||||
if (t > now)
|
||||
return (NULL);
|
||||
if (t == now)
|
||||
return (xstrdup("0s"));
|
||||
if (t > now) {
|
||||
sign = '+';
|
||||
age = t - now;
|
||||
} else {
|
||||
sign = '-';
|
||||
age = now - t;
|
||||
}
|
||||
age = now - t;
|
||||
|
||||
d = age / 86400;
|
||||
h = (age % 86400) / 3600;
|
||||
@@ -4072,21 +4068,21 @@ format_relative_time(time_t t)
|
||||
|
||||
if (d != 0) {
|
||||
if (h != 0)
|
||||
xsnprintf(out, sizeof out, "%c%ud%uh", sign, d, h);
|
||||
xsnprintf(out, sizeof out, "%ud%uh", d, h);
|
||||
else
|
||||
xsnprintf(out, sizeof out, "%c%ud", sign, d);
|
||||
xsnprintf(out, sizeof out, "%ud", d);
|
||||
} else if (h != 0) {
|
||||
if (m != 0)
|
||||
xsnprintf(out, sizeof out, "%c%uh%um", sign, h, m);
|
||||
xsnprintf(out, sizeof out, "%uh%um", h, m);
|
||||
else
|
||||
xsnprintf(out, sizeof out, "%c%uh", sign, h);
|
||||
xsnprintf(out, sizeof out, "%uh", h);
|
||||
} else if (m != 0) {
|
||||
if (s != 0)
|
||||
xsnprintf(out, sizeof out, "%c%um%us", sign, m, s);
|
||||
xsnprintf(out, sizeof out, "%um%us", m, s);
|
||||
else
|
||||
xsnprintf(out, sizeof out, "%c%um", sign, m);
|
||||
xsnprintf(out, sizeof out, "%um", m);
|
||||
} else
|
||||
xsnprintf(out, sizeof out, "%c%us", sign, s);
|
||||
xsnprintf(out, sizeof out, "%us", s);
|
||||
return (xstrdup(out));
|
||||
}
|
||||
|
||||
@@ -5183,7 +5179,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
||||
else if (fm->argc >= 2 &&
|
||||
strchr(fm->argv[0], 'f') != NULL) {
|
||||
free(time_format);
|
||||
time_format = format_strip(es, fm->argv[1]);
|
||||
time_format = format_strip(es,
|
||||
fm->argv[1]);
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: tmux.1,v 1.1080 2026/06/11 10:16:19 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.1081 2026/06/13 08:59:52 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: June 11 2026 $
|
||||
.Dd $Mdocdate: June 13 2026 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -6410,9 +6410,9 @@ will use shorter but less accurate time format for times in the past.
|
||||
.Ql r
|
||||
.Pq Ql t/r
|
||||
will show the time relative to the current time, for example
|
||||
.Ql \-1m
|
||||
.Ql \1m
|
||||
or
|
||||
.Ql +2m23s .
|
||||
.Ql 2m23s .
|
||||
A custom format may be given using an
|
||||
.Ql f
|
||||
suffix (note that
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window-clock.c,v 1.32 2026/04/22 07:05:59 nicm Exp $ */
|
||||
/* $OpenBSD: window-clock.c,v 1.33 2026/06/13 08:59:52 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -175,7 +175,7 @@ window_clock_init(struct window_mode_entry *wme,
|
||||
struct window_clock_mode_data *data;
|
||||
struct screen *s;
|
||||
|
||||
wme->data = data = xmalloc(sizeof *data);
|
||||
wme->data = data = xcalloc(1, sizeof *data);
|
||||
data->tim = time(NULL);
|
||||
|
||||
evtimer_set(&data->timer, window_clock_timer_callback, wme);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window-copy.c,v 1.404 2026/06/10 14:29:08 nicm Exp $ */
|
||||
/* $OpenBSD: window-copy.c,v 1.405 2026/06/13 08:59:52 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -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_copy_mode_data *data;
|
||||
|
||||
if (wme == NULL)
|
||||
return;
|
||||
if (wme->mode != &window_copy_mode)
|
||||
if (wme == NULL || wme->mode != &window_copy_mode)
|
||||
return;
|
||||
data = wme->data;
|
||||
if (data == NULL)
|
||||
return;
|
||||
if (data->line_numbers == enabled)
|
||||
if (data == NULL || data->line_numbers == enabled)
|
||||
return;
|
||||
data->line_numbers = enabled;
|
||||
window_copy_redraw_screen(wme);
|
||||
|
||||
Reference in New Issue
Block a user