diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index 7212e802f..aa5a71bae 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -192,7 +192,7 @@ void HistoryController::willDisplayCellForIndex(HighlightCell * cell, int index) HistoryViewCell * myCell = (HistoryViewCell *)cell; myCell->setCalculation(calculationAtIndex(index).pointer(), index == selectedRow() && selectedSubviewType() == SubviewType::Output); myCell->setEven(index%2 == 0); - myCell->setHighlighted(myCell->isHighlighted()); + myCell->reloadSubviewHighlight(); } KDCoordinate HistoryController::rowHeight(int j) { diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index 05df03ae8..69713ffe3 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -22,7 +22,7 @@ void HistoryViewCellDataSource::setSelectedSubviewType(SubviewType subviewType, HistoryViewCell * previouslySelectedCell = nullptr; historyViewCellDidChangeSelection(&selectedCell, &previouslySelectedCell, previousSelectedCellX, previousSelectedCellY); if (selectedCell) { - selectedCell->setHighlighted(selectedCell->isHighlighted()); + selectedCell->reloadSubviewHighlight(); selectedCell->cellDidSelectSubview(subviewType); } if (previouslySelectedCell) { @@ -56,8 +56,16 @@ void HistoryViewCell::setEven(bool even) { } void HistoryViewCell::setHighlighted(bool highlight) { - assert(m_dataSource); + if (m_highlighted == highlight) { + return; + } m_highlighted = highlight; + // Re-layout as the ellispsis subview might have appear/disappear + layoutSubviews(); +} + +void HistoryViewCell::reloadSubviewHighlight() { + assert(m_dataSource); m_inputView.setExpressionBackgroundColor(backgroundColor()); m_scrollableOutputView.evenOddCell()->setHighlighted(false); m_ellipsis.setHighlighted(false); diff --git a/apps/calculation/history_view_cell.h b/apps/calculation/history_view_cell.h index 10bac7e49..dc56c9237 100644 --- a/apps/calculation/history_view_cell.h +++ b/apps/calculation/history_view_cell.h @@ -34,6 +34,7 @@ public: void cellDidSelectSubview(HistoryViewCellDataSource::SubviewType type); void setEven(bool even) override; void setHighlighted(bool highlight) override; + void reloadSubviewHighlight(); void setDataSource(HistoryViewCellDataSource * dataSource) { m_dataSource = dataSource; } Responder * responder() override { return this;