cmux-tui: closing a screen, pane or workspace keeps its tab groups for reopen (cx-gzh.31)

Merged
TE
22d ago
+188-83

Summary

Until now, only Close Group kept its group in closed history (#20630, #20723). If you closed a screen, pane or workspace, or closed a group's last tab, the groups inside were dropped, and Cmd-Shift-T brought the tabs back loose.

  • capture_closed now records every live tab group that holds a closing tab, whether the tab closes by itself or inside a closing screen or workspace. Each group goes on the closed-history record as an entry in tab_groups, naming only its closed tabs in strip order. Groups in ephemeral (incognito) workspaces are never recorded. The lookup lives in the new state/closed_tab_groups.rs.
  • Reopen forms each group again around the tabs it brought back, keeping the id, name, color and icon. If the group is still open, the reopened tabs join it instead. Groups none of whose tabs came back are skipped.
  • Close Group now uses the same capture, so StripEdit.closed_group and attach_closed_tab_group are removed. Records stored with the older single tab_group still reopen.
  • Behavior change: Cmd-Shift-T on a tab closed out of a still-open group puts it back in that group (as Chrome does), at the group's end.

Testing

  • Red: c8b0dd908718 adds a_closed_screen_reopens_with_its_tab_group (screen.close on a 3-tab screen holding a 2-tab group).
  • Green: on the fix head with the reopen filter, which also covers the existing Close Group, ungroup and partial-reopen tests. Results to follow in a comment.

Changelog

Fixed: Reopening a closed screen, pane or workspace brings back the tab groups it held.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Reopening a closed screen, pane, or workspace now restores the tab groups it held, instead of bringing the tabs back loose.

  • Closing a tab records every live tab group holding it (directly, or inside a closing screen, pane, or workspace) in closed history, naming the group's closed tabs in strip order. Only memberships of tabs still in the group's pane are recorded; groups in ephemeral (incognito) workspaces are never recorded.
  • Reopen forms each recorded group again around the tabs it brought back, preserving the group's id, name, color, and icon; if the group still holds an open tab, the reopened tabs join it instead. A leftover group row whose pane closed holds no open tab, so it is not live and forms again.
  • Close Group now uses the same capture path, replacing its separate attach step; records stored with the older single tab_group field still reopen.
  • Behavior change: Cmd-Shift-T on a tab closed from a still-open group now puts it back in that group (as Chrome does), at the group's end.