mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-02 07:06:48 -06:00
A sheet's view is not an undo step: Excel doesn't undo a switch between Normal, Page Layout and Page Break Preview, and view.normal, view.pageLayout and view.pageBreakPreview are noundo here. But undo and redo swap in a whole snapshot of the workbook, so undoing an earlier edit put back the view the sheet had then: set A1, switch to Page Break Preview, undo, and the sheet was in Normal again (redo switched it back). Undo and redo now keep each sheet's current view (extra::keep_view_modes), as they already keep the Watch Window list, carrying it through each step of a multi-step undo or redo. Sheets are matched by name; while a rename is undone or redone, by position under the name the restored snapshot doesn't have. A view kept this way doesn't make a saved workbook dirty, as set_view doesn't. Tests: undo and redo with each view, undoing a rename and a new sheet, a rename and a new sheet undone and redone with steps: 2, and redo back to the saved state staying clean. Each fails without the change (the view reverted to Normal).