layout-custom: emit an empty v1 body for windows with only floating panes

layout_append() returned failure for the version 1 (old) layout format
when a window's tree has no tiled cell anywhere - e.g. a window left
with only floating panes after the last tiled pane closed. layout_dump()
turns that failure into NULL, surfacing as an empty #{window_layout}
instead of the minimal valid placeholder body a control client or
select-layout round-trip expects. Return success with nothing written
instead, which composes into the checksum-prefixed empty body via the
existing formatting path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Grant
2026-09-20 22:38:45 +01:00
parent e963101c03
commit bc177a2d66

View File

@@ -509,7 +509,7 @@ layout_append(struct layout_cell *lcroot, struct layout_string *ls, int flags)
if (flags & LAYOUT_CUSTOM_OLD_FORMAT) {
if (!layout_cell_is_tiled(lcroot) &&
!layout_cell_has_tiled_child(lcroot))
return (-1);
return (0); /* no tiled cell anywhere: empty v1 body */
lccompat = layout_custom_create_compat(lcroot);
result = layout_append_v1(lccompat, ls);
layout_custom_free_compat(lccompat);