diff --git a/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Applications/Spreadsheet/SpreadsheetWidget.cpp index c3912e6684..1b5fec57fa 100644 --- a/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -131,10 +131,15 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) m_cell_value_editor->on_change = nullptr; m_cell_value_editor->set_text(""); + m_should_change_selected_cells = false; + m_cell_value_editor->on_focusin = [this] { m_should_change_selected_cells = true; }; + m_cell_value_editor->on_focusout = [this] { m_should_change_selected_cells = false; }; m_cell_value_editor->on_change = [cells = move(cells), this] { - for (auto* cell : cells) - cell->set_data(m_cell_value_editor->text()); - m_selected_view->sheet().update(); + if (m_should_change_selected_cells) { + for (auto* cell : cells) + cell->set_data(m_cell_value_editor->text()); + m_selected_view->sheet().update(); + } }; m_cell_value_editor->set_enabled(true); }; diff --git a/Applications/Spreadsheet/SpreadsheetWidget.h b/Applications/Spreadsheet/SpreadsheetWidget.h index a474a5829b..6c84142409 100644 --- a/Applications/Spreadsheet/SpreadsheetWidget.h +++ b/Applications/Spreadsheet/SpreadsheetWidget.h @@ -55,6 +55,7 @@ private: RefPtr m_current_cell_label; RefPtr m_cell_value_editor; RefPtr m_tab_widget; + bool m_should_change_selected_cells { false }; OwnPtr m_workbook; };