mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] HistoryViewCell: when reloading the entire table due
to a cell selection, the cell used for the selected row might change. We thereby have to update the selected cell once the table has been reloaded. This fixes the following bug: add 5 times the calculation "12.2". Go up, the selected expression is the left one instead of the right one.
This commit is contained in:
committed by
LeaNumworks
parent
6a5708a562
commit
f3c6aab669
@@ -112,13 +112,12 @@ void HistoryController::tableViewDidChangeSelection(SelectableTableView * t, int
|
||||
if (withinTemporarySelection || previousSelectedCellY == selectedRow()) {
|
||||
return;
|
||||
}
|
||||
HistoryViewCell * cell = static_cast<HistoryViewCell *>(t->selectedCell());
|
||||
if (previousSelectedCellY == -1) {
|
||||
setSelectedSubviewType(SubviewType::Output, cell);
|
||||
setSelectedSubviewType(SubviewType::Output);
|
||||
} else if (selectedRow() < previousSelectedCellY) {
|
||||
setSelectedSubviewType(SubviewType::Output, cell);
|
||||
setSelectedSubviewType(SubviewType::Output);
|
||||
} else if (selectedRow() > previousSelectedCellY) {
|
||||
setSelectedSubviewType(SubviewType::Input, cell);
|
||||
setSelectedSubviewType(SubviewType::Input);
|
||||
}
|
||||
HistoryViewCell * selectedCell = (HistoryViewCell *)(t->selectedCell());
|
||||
if (selectedCell == nullptr) {
|
||||
@@ -166,10 +165,12 @@ void HistoryController::scrollToCell(int i, int j) {
|
||||
m_selectableTableView.scrollToCell(i, j);
|
||||
}
|
||||
|
||||
void HistoryController::historyViewCellDidChangeSelection() {
|
||||
HistoryViewCell * HistoryController::historyViewCellDidChangeSelection() {
|
||||
/* Update the whole table as the height of the selected cell row might have
|
||||
* changed. */
|
||||
m_selectableTableView.reloadData();
|
||||
// Return the selected cell if one
|
||||
return static_cast<HistoryViewCell *>(m_selectableTableView.selectedCell());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user