cmux-tui: a reopened tab group keeps its saved-group link and its order (cx-gzh.31)

Merged
TE
23d ago
+135-8

Summary

If a saved tab group was closed and then reopened, the group came back unsaved. On a partial reopen, the tabs restored later were also appended to the end of the live group instead of returning to their own places.

  • When a close records a tab group, its saved-group link (saved_id) is stored with it (state/closed_tab_groups.rs).
  • When reopen forms the group again, it relinks it to that saved group. It skips this if the saved group has been deleted or another live group took it (Reopen Saved Group since the close). The saved record is refreshed in the same strip change.
  • Tabs that a later partial reopen brings back rejoin the live group in strip order. Each has already been put back at its recorded index, so the group keeps the order it closed in. This uses rejoin_closed_tab_group instead of tab_group_add(.., None).

Testing

  • Red: at a7302081eb9a, a_closed_saved_group_reopens_linked_and_in_order failed on Linux and macOS in hosted run 38680818338 (the saved_tab_group_id was Null).
  • Green: at ecce626488a9, hosted run 38682764116 with the reopen filter. Result to follow in a comment.

Changelog

Fixed: A reopened saved tab group stays saved, and its tabs keep their order.

🤖 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

Fixes reopening a saved tab group so it stays linked to its saved record and keeps its tab order.

  • When a group closes, its saved-group link is stored with the archive.
  • Reopen relinks the group to that saved group unless the saved group is gone or another live group took it.
  • The saved record stays untouched — it still names every closed tab, not only the ones reopened so far.
  • Tabs restored by a later partial reopen rejoin the live group in strip order instead of appending at the end.