diff options
author | nicm <nicm> | 2022-06-21 09:30:01 +0000 |
---|---|---|
committer | nicm <nicm> | 2022-06-21 09:30:01 +0000 |
commit | 9c89f7c2af748858e784e8c533c548460bd6b10e (patch) | |
tree | ea324297eba8f5f8ecb2941a87736dcd847f3914 /window-copy.c | |
parent | a888ce9963053c790c6ee9bf64cc53d95f0f9c09 (diff) | |
download | rtmux-9c89f7c2af748858e784e8c533c548460bd6b10e.tar.gz rtmux-9c89f7c2af748858e784e8c533c548460bd6b10e.tar.bz2 rtmux-9c89f7c2af748858e784e8c533c548460bd6b10e.zip |
Store time lines are scrolled into history and display in copy mode.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/window-copy.c b/window-copy.c index 09304218..b955d222 100644 --- a/window-copy.c +++ b/window-copy.c @@ -4092,8 +4092,9 @@ window_copy_write_line(struct window_mode_entry *wme, struct window_copy_mode_data *data = wme->data; struct screen *s = &data->screen; struct options *oo = wp->window->options; + struct grid_line *gl; struct grid_cell gc, mgc, cgc, mkgc; - char hdr[512]; + char hdr[512], tmp[256], *t; size_t size = 0; u_int hsize = screen_hsize(data->backing); @@ -4107,23 +4108,29 @@ window_copy_write_line(struct window_mode_entry *wme, mkgc.flags |= GRID_FLAG_NOPALETTE; if (py == 0 && s->rupper < s->rlower && !data->hide_position) { + gl = grid_get_line(data->backing->grid, hsize - data->oy); + if (gl->time == 0) + xsnprintf(tmp, sizeof tmp, "[%u/%u]", data->oy, hsize); + else { + t = format_pretty_time(gl->time, 1); + xsnprintf(tmp, sizeof tmp, "%s [%u/%u]", t, data->oy, + hsize); + free(t); + } + if (data->searchmark == NULL) { if (data->timeout) { size = xsnprintf(hdr, sizeof hdr, - "(timed out) [%u/%u]", data->oy, hsize); - } else { - size = xsnprintf(hdr, sizeof hdr, - "[%u/%u]", data->oy, hsize); - } + "(timed out) %s", tmp); + } else + size = xsnprintf(hdr, sizeof hdr, "%s", tmp); } else { - if (data->searchcount == -1) { - size = xsnprintf(hdr, sizeof hdr, - "[%u/%u]", data->oy, hsize); - } else { + if (data->searchcount == -1) + size = xsnprintf(hdr, sizeof hdr, "%s", tmp); + else { size = xsnprintf(hdr, sizeof hdr, - "(%d%s results) [%u/%u]", data->searchcount, - data->searchmore ? "+" : "", data->oy, - hsize); + "(%d%s results) %s", data->searchcount, + data->searchmore ? "+" : "", tmp); } } if (size > screen_size_x(s)) |