This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit 1833912e60b5f8bfd4821763f19a288589a19529
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Nov 18 21:40:28 2026 -0600
termpty: count a wide new backlog entry by its wrapped rows
termpty_text_save_top() advanced the backlog beacon by one row for every
new entry, while termpty_backlog_length() counts DIV_ROUND_UP(w, ty->w)
rows per entry when it walks them. An entry wider than the screen only
comes from a tymux client rebuilding a line from wire chunks, and the
first chunk, up to 1920 cells, was counted as one row: the length of the
reattached backlog came out 23 rows short of the sum of its entries.
Use the same row count for the beacon. No escape code checksum changes:
a locally parsed line is never wider than the screen.
---
src/bin/termpty.c | 35 ++++++++++++++++++++++++++++++++++-
src/bin/tytest.c | 1 +
src/bin/unit_tests.h | 1 +
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 039ee9bb..624c25e2 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1145,7 +1145,7 @@ add_new_ts:
if (ty->backlog_hook.func)
ty->backlog_hook.func(ty->backlog_hook.data, ty, cells, w);
- ty->backlog_beacon.screen_y++;
+ ty->backlog_beacon.screen_y += (w == 0) ? 1 : DIV_ROUND_UP(w, ty->w);
ty->backlog_beacon.backlog_y++;
if (ty->backlog_beacon.backlog_y >= (int)ty->backsize)
{
@@ -4972,6 +4972,39 @@ tytest_backlog_hook(void)
return 0;
}
+/* Test: an entry wider than the screen, as the line a tymux client
+ * rebuilds from wire chunks is, is counted by the rows it wraps over by
+ * termpty_text_save_top() itself, the way termpty_backlog_length() counts
+ * it when it walks the entries. */
+int
+tytest_backlog_wide_entry_rows(void)
+{
+ Termpty ty;
+ Termcell cells[25];
+ int j;
+
+ _ty_test_init(&ty, 10, 5);
+ termpty_backlog_size_set(&ty, 20);
+ memset(cells, 0, sizeof(cells));
+ for (j = 0; j < 25; j++)
+ cells[j].codepoint = 'a';
+
+ termpty_text_save_top(&ty, cells, 25);
+ assert(termpty_backlog_length(&ty) == 3);
+
+ /* a narrow line after it is one more row */
+ termpty_text_save_top(&ty, cells, 4);
+ assert(termpty_backlog_length(&ty) == 4);
+
+ /* the walk over the entries gives the same count as the beacon kept */
+ ty.backlog_beacon.screen_y = 0;
+ ty.backlog_beacon.backlog_y = 0;
+ assert(termpty_backlog_length(&ty) == 4);
+
+ _ty_test_shutdown(&ty);
+ return 0;
+}
+
/* Test: a logical line spanning several wrapped rows arrives intact on the
* other end when every hook call is replayed through
* termpty_text_save_top() again: the hook reports each row (not the merged
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 6880315e..87c30eff 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -36,6 +36,7 @@ static struct {
{ "write_hook", tytest_write_hook},
{ "backlog_hook", tytest_backlog_hook},
{ "backlog_hook_wrap_replay", tytest_backlog_hook_wrap_replay},
+ { "backlog_wide_entry_rows", tytest_backlog_wide_entry_rows},
{ "simd_parity", tytest_simd_parity},
{ "rgb_to_palette", tytest_rgb_to_palette},
{ "colors_is_dark", tytest_colors_is_dark},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index 4cc90ee9..406b88e8 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -9,6 +9,7 @@ int tytest_dummy(void);
int tytest_write_hook(void);
int tytest_backlog_hook(void);
int tytest_backlog_hook_wrap_replay(void);
+int tytest_backlog_wide_entry_rows(void);
int tytest_simd_parity(void);
int tytest_rgb_to_palette(void);
int tytest_colors_is_dark(void);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.