szn

Bug 165 — server/render.zig — writeBytes doesn’t retry partial writes

165. server/render.zig — writeBytes doesn’t retry partial writes

File: src/server/render.zig:75 Severity: HIGH Status: ✅ FIXED — added retry loop with partial write handling and EINTR detection.

if (c.write(self.fd, bytes.ptr, bytes.len) < 0) return error.WriteFailed;

c.write() can return a positive value less than bytes.len (partial write). The code only checks for < 0. Remaining bytes are silently dropped, corrupting terminal output. If a partial write occurs mid-escape-sequence, the terminal gets corrupted state — garbled display, wrong colours, broken borders.

All writeColourFg, writeColourBg, writeString, writeStr, renderContent, renderStatusBar, moveTo, enterAltScreen, exitAltScreen, renderAll, and renderSixelImages go through this function.

Fix: Add retry loop handling partial writes and EINTR, matching the pattern used in renderToDisplayClient (server.zig:1200–1220).