This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/36/head
in repository terminology.
View the commit online.
commit 3481d91bed47c8590bcaadb4f9ce038931a20d33
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 22 10:16:25 2026 -0600
feat: add backlog_get callback to Termpty for custom scrollback
Add a callback hook to the Termpty struct that allows alternative
backlog implementations. When set, termpty_cellrow_get delegates
negative-y (scrollback) requests to the callback instead of the
Termsave circular buffer. This will be used by the tymux shadow
PTY to read scrollback from shared-memory backlog buffers.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
src/bin/termpty.c | 2 ++
src/bin/termpty.h | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 42318fa5..50377650 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1164,6 +1164,8 @@ termpty_cellrow_get(Termpty *ty, int y_requested, ssize_t *wret)
*wret = termpty_line_length(cells, ty->w);
return cells;
}
+ if (ty->backlog_get.func)
+ return ty->backlog_get.func(ty->backlog_get.data, y_requested, wret);
if (!ty->back)
return NULL;
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 94c2947d..34de8bd8 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -162,6 +162,15 @@ struct tag_Termpty
void (*func)(const char *buf, int len, void *data);
void *data;
} write_cb;
+ /* Optional callback for backlog access (used by tymux shadow PTY).
+ * When set, termpty_cellrow_get delegates negative-y requests here
+ * instead of the Termsave-based backlog. The callback must return
+ * a pointer to Termcell data valid until the next call, and set
+ * *wret to the number of cells. Returns NULL if y is out of range. */
+ struct {
+ Termcell *(*func)(void *data, int y, ssize_t *wret);
+ void *data;
+ } backlog_get;
struct {
const char *icon;
/* dynamic title set by xterm, keep it in case user don't want a
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.