Feature request: capture/restore per-line times (grid_line.time) for session persistence
Issue description
This is a feature request / suggestion, not a bug.
Summary: please expose a way to (1) read per-line times (grid_line.time)
via capture-pane, and (2) set them when replaying captured content, so
session-persistence tools (tmux-resurrect / tmux-continuum and similar) can
preserve the copy-mode line-time indicator across a server restart.
Current behaviour
tmux already tracks a per-line timestamp in grid_line.time, exposes it to
formats as #{top_line_time}, and shows it in the copy-mode position
indicator by default (copy-mode-position-format starts with
#[align=right]#{t/p:top_line_time}...). It is genuinely useful for
answering "when did this scroll past".
tmux-resurrect persists scrollback by capturing it with capture-pane -p at
save time and, on restore, spawning each pane with
cat <saved-file>; exec <shell>. Because the saved content is re-printed as
fresh output, every restored line is stamped by grid_line_set_time() with
the restore time and all the original per-line times are lost. The indicator
then shows the moment of restoration for the entire history.
Gap 1 - capture-pane cannot emit per-line times
capture-pane -L prefixes the line number and -F prefixes flags
(D/H/O/P/W/X); the -F path already calls grid_peek_line(gd, i) per line,
but there is no option to also include grid_line_time(gl). A new capture
option (or an extension to the -F/-L output, or a per-line capture
format) would let a tool record the times alongside the text.
Gap 2 - no way to set line times on replayed content
grid_line_set_time() takes no time argument (always current_time), and
gl->time is stored as a u_int delta from start_time.tv_sec, so it
structurally cannot represent a timestamp from before the current server
started - which is exactly the persistence case. Restoring real historical
line times would need a path to supply them (a command, an option on whatever
replays the content, or an escape sequence) and probably a wider or optional
full-precision field.
If gap 2 is out of scope: even gap 1 alone would help - an external tool could store the times and surface them itself (a custom status line / overlay), though not in tmux's own indicator.
Motivation: the line-time indicator is the one piece of scrollback state that resurrect-style persistence cannot carry across a restart today.
Required information
- tmux version: 3.7c (also read the relevant code on master)
- Platform: Linux, x86_64 (
uname -sp->Linux unknown) - Terminal in use: Alacritty 0.17.0
$TERMinside tmux:tmux-256color$TERMoutside tmux:xterm-256color
This is a suggestion - completely understand if it is out of scope.
Source: tmux/tmux