diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index 5fca0aa98..251cc3a1f 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -169,8 +169,14 @@ void HistoryController::tableViewDidChangeSelection(SelectableTableView * t, int } else if (selectedRow() == -1) { setSelectedSubviewType(SubviewType::Input, false, previousSelectedCellX, previousSelectedCellY); } else { - setSelectedSubviewType(selectedSubviewType(), false, previousSelectedCellX, previousSelectedCellY); + HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell()); + SubviewType nextSelectedSubviewType = selectedSubviewType(); + if (!selectedCell->displaysSingleLine()) { + nextSelectedSubviewType = previousSelectedCellY < selectedRow() ? SubviewType::Input : SubviewType::Output; + } + setSelectedSubviewType(nextSelectedSubviewType, false, previousSelectedCellX, previousSelectedCellY); } + // The selectedCell may change during setSelectedSubviewType HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell()); if (selectedCell == nullptr) { return; diff --git a/apps/calculation/history_view_cell.h b/apps/calculation/history_view_cell.h index 2cca12b62..d50256fc8 100644 --- a/apps/calculation/history_view_cell.h +++ b/apps/calculation/history_view_cell.h @@ -42,6 +42,9 @@ public: void setHighlighted(bool highlight) override; void reloadSubviewHighlight(); void setDataSource(HistoryViewCellDataSource * dataSource) { m_dataSource = dataSource; } + bool displaysSingleLine() const { + return m_calculationSingleLine; + } Responder * responder() override { return this; }