FIX: Renaming a sheet with the same name doesn't do anything

Fixes #103
This commit is contained in:
Nicolás Hatcher
2024-10-24 08:15:40 +02:00
committed by Nicolás Hatcher Andrés
parent 79216b286b
commit ffa93309e2
2 changed files with 10 additions and 0 deletions

View File

@@ -457,6 +457,9 @@ impl UserModel {
/// * [Model::rename_sheet_by_index]
pub fn rename_sheet(&mut self, sheet: u32, new_name: &str) -> Result<(), String> {
let old_value = self.model.workbook.worksheet(sheet)?.name.clone();
if old_value == new_name {
return Ok(());
}
self.model.rename_sheet_by_index(sheet, new_name)?;
self.push_diff_list(vec![Diff::RenameSheet {
index: sheet,