Undo closing a widget #40
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Closing a widget is instant and destructive.
GridStackItem.close()detaches the element and fires the event:One misclick on the X and the widget is gone, along with its size and position. There is no confirmation and no way back short of a full layout reset, which throws away every other widget's placement too.
Proposal
Show an undo affordance instead of a confirmation dialog (a dialog on every close would be worse than the problem):
Notificationwith an "Rückgängig" action and a timeout.Position(id, x, y, w, h) before detaching — afterremoveFromParent()the grid no longer reports it.CloseEventalready carriesfromClient, so the undo can be limited to user-initiated closes and skip programmatic ones.Note the id constraint from
GridStackView.addWidget(): ids must stay stable, and a restored widget must come back under its original id or it loses its saved layout entry.Acceptance criteria
gs-idis unchanged.close()does not spawn an undo toast.Depends on
Nothing hard. Interacts with #22 — undo must not race the layout persistence (a close followed by undo should not leave a stale persisted layout).
Scope
Small.
PR ready, CI green: #48