From 81b0f58fd8e21fcc9128c1109dd42700a91d65af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 8 Feb 2017 16:19:04 +0100 Subject: [PATCH] [apps/sequence/list] Correct selection navigation Change-Id: I1d4ec884bae977e284affcfbc00f89379f53dd0b --- apps/sequence/list/list_controller.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index 04ab28f77..ae091e26c 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -67,12 +67,20 @@ bool ListController::handleEvent(Ion::Events::Event event) { void ListController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) { if (m_functionStore->numberOfFunctions() == m_functionStore->maxNumberOfFunctions() || t->selectedRow() < numberOfRows() - 1) { - if (t->selectedColumn() == 0) { - SequenceTitleCell * myCell = (SequenceTitleCell *)t->cellAtLocation(t->selectedColumn(), t->selectedRow()); - app()->setFirstResponder(myCell); + SequenceCell * myCell = (SequenceCell *)t->cellAtLocation(t->selectedColumn(), t->selectedRow()); + app()->setFirstResponder(myCell); + if (t->selectedRow() == -1) { + return; + } + if (t->selectedRow() == previousSelectedCellY) { + SequenceCell * otherCell = (SequenceCell *)t->cellAtLocation(previousSelectedCellX, previousSelectedCellY); + myCell->selectSubCell(otherCell->selectedSubCell()); } else { - SequenceExpressionCell * myCell = (SequenceExpressionCell *)t->cellAtLocation(t->selectedColumn(), t->selectedRow()); - app()->setFirstResponder(myCell); + if (t->selectedRow() < previousSelectedCellY) { + myCell->selectSubCell(myCell->numberOfSubCells()-1); + } else { + myCell->selectSubCell(0); + } } } else { if (app()->firstResponder() != t) {