This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux
in repository terminology.
View the commit online.
commit c32550c0cecb2ef7927bd6704e6ccd5421b18c49
Author: [email protected] <[email protected]>
AuthorDate: Thu Mar 19 23:10:27 2026 -0600
fix: delta rendering correctness and remaining review issues
- dblwidth: pen_col advances by 2 for double-width (CJK) characters
in _render_delta, preventing cursor position drift
- _render_full: flush output buffer before \r\n when near capacity,
preventing silent CR/LF drops on long lines
- _sync_shadow: update ty->w/ty->h on partial realloc failure so
screen dimensions stay consistent with actual allocation size
- _proto_recv_attached: validate hdr.size matches expected payload,
matching the fix already applied to termsrv_recv_attached
- Signal message: "received signal" instead of "received SIGINT"
since SIGTERM uses the same handler
- Comment fix: worst-case bytes is ~60, not 80
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
src/bin/termsession.c | 7 +++++--
src/bin/tymux.c | 13 ++++++++-----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/bin/termsession.c b/src/bin/termsession.c
index 348086d5..1e9a3519 100644
--- a/src/bin/termsession.c
+++ b/src/bin/termsession.c
@@ -172,8 +172,11 @@ _sync_shadow(TermSession *ts)
if (!s2)
{
ERR("termsession: realloc screen2 failed");
- /* ty->screen is the new (larger) allocation but ty->w/ty->h
- * remain at old values, so both buffers are >= old dimensions. */
+ /* screen was already reallocated (possibly shrunk); update
+ * dimensions so w*h matches what screen can hold. screen2
+ * may be over-allocated (old size) which is harmless. */
+ ty->w = (int)cols;
+ ty->h = (int)rows;
return;
}
ty->screen2 = s2;
diff --git a/src/bin/tymux.c b/src/bin/tymux.c
index 25b6736e..752f25f7 100644
--- a/src/bin/tymux.c
+++ b/src/bin/tymux.c
@@ -315,6 +315,7 @@ _proto_recv_attached(int sock_fd, int *shm_fd_out,
if (n < (ssize_t)(sizeof(hdr) + sizeof(pl))) return -1;
if (msg.msg_flags & MSG_CTRUNC) return -1;
if (hdr.type != _TSRV_MSG_ATTACHED) return -1;
+ if (hdr.size != sizeof(pl)) return -1;
struct cmsghdr *cm = CMSG_FIRSTHDR(&msg);
if (!cm || cm->cmsg_type != SCM_RIGHTS ||
@@ -466,7 +467,7 @@ _flush_buf(const char *buf, size_t pos)
*
* Tracks attribute/colour state via the cur_* pointers; only emits SGR when
* something changed. @pos is advanced; buf must have EMIT_CELL_MAX spare
- * bytes (conservatively 80 bytes covers the worst-case SGR + UTF-8 + move).
+ * bytes (~60 bytes worst-case SGR + UTF-8; 128 defined for headroom).
*/
#define EMIT_CELL_MAX 128
@@ -640,7 +641,9 @@ _render_full(const void *shm, _Termcell *prev,
if (row + 1 < srows)
{
- if (pos + 2 < bufsz) { out[pos++] = '\r'; out[pos++] = '\n'; }
+ if (pos + 2 >= bufsz) { _flush_buf(out, pos); pos = 0; }
+ out[pos++] = '\r';
+ out[pos++] = '\n';
}
}
@@ -742,8 +745,8 @@ _render_delta(const void *shm, _Termcell *prev,
&cur_strike, &cur_inv,
&cur_fg256, &cur_bg256);
- /* Cursor advances one column after writing a character */
- pen_col++;
+ /* Cursor advances; double-width chars move 2 columns */
+ pen_col += c->att.dblwidth ? 2 : 1;
*p = *c;
}
@@ -1156,7 +1159,7 @@ cmd_attach(int argc, char **argv)
* In raw mode, Ctrl+C sends 0x03 as data, not a signal;
* this handler fires only for signals from external processes. */
_got_int = 0;
- write(STDERR_FILENO, "\r\ntymux: received SIGINT, detaching\r\n", 37);
+ write(STDERR_FILENO, "\r\ntymux: received signal, detaching\r\n", 37);
_proto_send(sock, _TSRV_MSG_DETACH, NULL, 0);
running = 0;
break;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.