From e932e8f8959381f3504efe769a25d5a81a737b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 16 Oct 2019 15:49:00 +0200 Subject: [PATCH] [apps/calculation] Fix HistoryController: update the OutputView when reloading the table data --- apps/calculation/history_controller.cpp | 4 ++++ apps/calculation/history_view_cell.cpp | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/calculation/history_controller.cpp b/apps/calculation/history_controller.cpp index 49f88c0ba..324771026 100644 --- a/apps/calculation/history_controller.cpp +++ b/apps/calculation/history_controller.cpp @@ -26,6 +26,8 @@ void HistoryController::reload() { */ if (numberOfRows() > 0) { m_selectableTableView.scrollToCell(0, numberOfRows()-1); + // Force to reload last added cell (hide the burger and exact output if necessary) + tableViewDidChangeSelection(&m_selectableTableView, 0, numberOfRows()-1); } } @@ -135,6 +137,8 @@ void HistoryController::tableViewDidChangeSelection(SelectableTableView * t, int setSelectedSubviewType(SubviewType::Output, previousSelectedCellX, previousSelectedCellY); } else if (selectedRow() > previousSelectedCellY) { setSelectedSubviewType(SubviewType::Input, previousSelectedCellX, previousSelectedCellY); + } else if (selectedRow() == -1) { + setSelectedSubviewType(SubviewType::Input, previousSelectedCellX, previousSelectedCellY); } HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell()); if (selectedCell == nullptr) { diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index 7160d9081..f53a58949 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -165,7 +165,6 @@ void HistoryViewCell::setCalculation(Calculation * calculation) { Poincare::Layout leftOutputLayout = calculation->createExactOutputLayout(); Poincare::Layout rightOutputLayout = (m_calculationDisplayOutput == Calculation::DisplayOutput::ExactOnly) ? leftOutputLayout : calculation->createApproximateOutputLayout(context); - m_scrollableOutputView.setDisplayLeftLayout(m_calculationDisplayOutput == Calculation::DisplayOutput::ExactAndApproximate); // Must be before the setLayouts fo the reload m_scrollableOutputView.setLayouts(rightOutputLayout, leftOutputLayout); I18n::Message equalMessage = calculation->exactAndApproximateDisplayedOutputsAreEqual(context) == Calculation::EqualSign::Equal ? I18n::Message::Equal : I18n::Message::AlmostEqual; m_scrollableOutputView.setEqualMessage(equalMessage);