Change cellused/size to 16 bits and time to 32 bits in grid_line and add

the OSC 133 positions (size stays the same).
This commit is contained in:
nicm
2026-07-20 11:16:33 +00:00
committed by tmux update bot
parent efcfc55535
commit d13b69ece4
6 changed files with 166 additions and 49 deletions

31
grid.c
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: grid.c,v 1.153 2026/07/02 08:51:05 nicm Exp $ */
/* $OpenBSD: grid.c,v 1.154 2026/07/20 11:16:33 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -194,6 +194,25 @@ grid_get_line(struct grid *gd, u_int line)
return (&gd->linedata[line]);
}
/* Get line time. */
time_t
grid_line_time(const struct grid_line *gl)
{
if (gl->time == 0)
return (0);
return (start_time.tv_sec + gl->time - 1);
}
/* Set line time. */
static void
grid_line_set_time(struct grid_line *gl)
{
if (current_time == 0)
gl->time = 0;
else
gl->time = current_time - start_time.tv_sec + 1;
}
/* Adjust number of lines. */
void
grid_adjust_lines(struct grid *gd, u_int lines)
@@ -435,7 +454,7 @@ grid_scroll_history(struct grid *gd, u_int bg)
gd->hscrolled++;
grid_compact_line(&gd->linedata[gd->hsize]);
gd->linedata[gd->hsize].time = current_time;
grid_line_set_time(&gd->linedata[gd->hsize]);
gd->hsize++;
gd->scroll_added++;
}
@@ -477,7 +496,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower, u_int bg)
/* Move the line into the history. */
memcpy(gl_history, gl_upper, sizeof *gl_history);
gl_history->time = current_time;
grid_line_set_time(gl_history);
/* Then move the region up and clear the bottom line. */
memmove(gl_upper, gl_upper + 1, (lower - upper) * sizeof *gl_upper);
@@ -1650,8 +1669,14 @@ grid_line_flags_string(int flags)
strlcat(s, "DEAD,", sizeof s);
if (flags & GRID_LINE_START_PROMPT)
strlcat(s, "START_PROMPT,", sizeof s);
if (flags & GRID_LINE_SECOND_PROMPT)
strlcat(s, "SECOND_PROMPT,", sizeof s);
if (flags & GRID_LINE_START_COMMAND)
strlcat(s, "START_COMMAND,", sizeof s);
if (flags & GRID_LINE_START_OUTPUT)
strlcat(s, "START_OUTPUT,", sizeof s);
if (flags & GRID_LINE_END_OUTPUT)
strlcat(s, "END_OUTPUT,", sizeof s);
if (flags & GRID_LINE_HYPERLINK)
strlcat(s, "HYPERLINK,", sizeof s);
if (*s == '\0')