FIX: Undo/redo delete/add page

Now we can undo adding or deleting worksheets
This commit is contained in:
Nicolás Hatcher
2025-02-05 21:43:20 +01:00
committed by Nicolás Hatcher Andrés
parent d866e283e9
commit dc8bb6da21
6 changed files with 102 additions and 20 deletions

View File

@@ -2,7 +2,7 @@ use std::collections::HashMap;
use bitcode::{Decode, Encode};
use crate::types::{Cell, Col, Row, SheetState, Style};
use crate::types::{Cell, Col, Row, SheetState, Style, Worksheet};
#[derive(Clone, Encode, Decode)]
pub(crate) struct RowData {
@@ -83,6 +83,10 @@ pub(crate) enum Diff {
column: i32,
old_data: Box<ColumnData>,
},
DeleteSheet {
sheet: u32,
old_data: Box<Worksheet>,
},
SetFrozenRowsCount {
sheet: u32,
new_value: i32,
@@ -93,9 +97,6 @@ pub(crate) enum Diff {
new_value: i32,
old_value: i32,
},
DeleteSheet {
sheet: u32,
},
NewSheet {
index: u32,
name: String,
@@ -174,11 +175,6 @@ impl History {
None => None,
}
}
pub fn clear(&mut self) {
self.redo_stack = vec![];
self.undo_stack = vec![];
}
}
#[derive(Clone, Encode, Decode)]