From bcab6b5a312439358c35d53ecb85110f90fa5156 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 3 Nov 2021 19:16:31 -0500 Subject: [PATCH] Spreadsheet: Prevent marking a cell dirty when the content didn't change --- src/Mod/Spreadsheet/Gui/SheetModel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index ed12e8ad44..c289dcc121 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -547,6 +547,16 @@ bool SheetModel::setData(const QModelIndex & index, const QVariant & value, int try { QString str = value.toString(); + + // Check to see if this is already the value in the cell, and skip the update if so + auto cell = sheet->getCell(address); + if (cell) { + std::string oldContent; + cell->getStringContent(oldContent); + if (str == QString::fromStdString(oldContent)) + return true; + } + Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit cell")); // Because of possible complication of recursively escaped // characters, let's take a shortcut and bypass the command