From 1281a4a508807f9befcba228a4b528716e8881e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 26 Jun 2020 17:34:25 +0200 Subject: [PATCH] [apps/calculation] HistoryController: avoid duplicate code when handling backspace event. Keep the same selected subview. --- apps/calculation/history_controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index 33185d172..41037c3f6 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -128,8 +128,11 @@ bool HistoryController::handleEvent(Ion::Events::Event event) { return true; } m_selectableTableView.selectCellAtLocation(0, focusRow > 0 ? focusRow - 1 : 0); - m_selectableTableView.scrollToCell(0, selectedRow()); - tableViewDidChangeSelectionAndDidScroll(&m_selectableTableView, 0, (subviewType == SubviewType::Input) ? selectedRow() : -1); + HistoryViewCell * selectedCell = static_cast(m_selectableTableView.selectedCell()); + if (subviewType == SubviewType::Ellipsis && selectedCell->additionalInformationType() == Calculation::AdditionalInformationType::None) { + subviewType = SubviewType::Output; + } + setSelectedSubviewType(subviewType, true, 0, selectedRow()); return true; } if (event == Ion::Events::Clear) {