diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index a8afa2b83..0d8a64aaf 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -82,11 +82,17 @@ void CalculationController::tableViewDidChangeSelection(SelectableTableView * t, } } if (t->selectedColumn() > 0 && t->selectedRow() >= 0 && t->selectedRow() <= k_totalNumberOfDoubleBufferRows) { + // If we are on a double text cell, we have to choose which subcell to select EvenOddDoubleBufferTextCellWithSeparator * myCell = (EvenOddDoubleBufferTextCellWithSeparator *)t->selectedCell(); + // Default selected subcell is the left one bool firstSubCellSelected = true; if (previousSelectedCellX > 0 && previousSelectedCellY >= 0 && previousSelectedCellY <= k_totalNumberOfDoubleBufferRows) { + // If we come from another double text cell, we have to update subselection EvenOddDoubleBufferTextCellWithSeparator * myPreviousCell = (EvenOddDoubleBufferTextCellWithSeparator *)t->cellAtLocation(previousSelectedCellX, previousSelectedCellY); - firstSubCellSelected = myPreviousCell->firstTextSelected(); + /* If the selection stays in the same column, we copy the subselection + * from previous cell. Otherwise, the selection has jumped to another + * column, we thus subselect the other subcell. */ + firstSubCellSelected = t->selectedColumn() == previousSelectedCellX ? myPreviousCell->firstTextSelected() : !myPreviousCell->firstTextSelected(); } myCell->selectFirstText(firstSubCellSelected); }