diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index b83ff5879..3fca09d90 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -166,12 +166,10 @@ void HistoryController::tableViewDidChangeSelection(SelectableTableView * t, int } if (previousSelectedCellY == -1) { setSelectedSubviewType(SubviewType::Output, false, previousSelectedCellX, previousSelectedCellY); - } else if (selectedRow() < previousSelectedCellY) { - setSelectedSubviewType(SubviewType::Output, false, previousSelectedCellX, previousSelectedCellY); - } else if (selectedRow() > previousSelectedCellY) { - setSelectedSubviewType(SubviewType::Input, false, previousSelectedCellX, previousSelectedCellY); } else if (selectedRow() == -1) { setSelectedSubviewType(SubviewType::Input, false, previousSelectedCellX, previousSelectedCellY); + } else { + setSelectedSubviewType(selectedSubviewType(), false, previousSelectedCellX, previousSelectedCellY); } HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell()); if (selectedCell == nullptr) { diff --git a/apps/calculation/history_view_cell.h b/apps/calculation/history_view_cell.h index 1a378067e..664f9e6ee 100644 --- a/apps/calculation/history_view_cell.h +++ b/apps/calculation/history_view_cell.h @@ -19,7 +19,7 @@ public: }; HistoryViewCellDataSource() : m_selectedSubviewType(SubviewType::Output) {} void setSelectedSubviewType(SubviewType subviewType, bool sameCell, int previousSelectedX = -1, int previousSelectedY = -1); - SubviewType selectedSubviewType() { return m_selectedSubviewType; } + SubviewType selectedSubviewType() const { return m_selectedSubviewType; } private: /* This method should belong to a delegate instead of a data source but as * both the data source and the delegate will be the same controller, we