SL-6109 Crash fix for left right selection shift when nothing or whole string is selected

master
Andrey Kleshchev 2020-12-03 13:26:44 +02:00
parent 9abac37e42
commit 65d661bc67
1 changed files with 34 additions and 28 deletions

View File

@ -2226,22 +2226,25 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask )
{
// TODO: support multi-select
LLScrollListItem *item = getFirstSelected();
S32 cell = item->getSelectedCell();
switch (mSelectionType)
if (item)
{
case CELL:
if (cell < mColumns.size()) cell++;
break;
case HEADER:
if (cell == -1) cell = 1;
else if (cell > 1 && cell < mColumns.size()) cell++; // skip header
break;
case ROW:
cell = -1;
break;
S32 cell = item->getSelectedCell();
switch (mSelectionType)
{
case CELL:
if (cell < mColumns.size()) cell++;
break;
case HEADER:
if (cell == -1) cell = 1;
else if (cell > 1 && cell < mColumns.size()) cell++; // skip header
break;
case ROW:
cell = -1;
break;
}
item->setSelectedCell(cell);
handled = TRUE;
}
item->setSelectedCell(cell);
handled = TRUE;
}
break;
case KEY_RIGHT:
@ -2249,22 +2252,25 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask )
{
// TODO: support multi-select
LLScrollListItem *item = getFirstSelected();
S32 cell = item->getSelectedCell();
switch (mSelectionType)
if (item)
{
case CELL:
if (cell >= 0) cell--;
break;
case HEADER:
if (cell > 1) cell--;
else if (cell == 1) cell = -1; // skip header
break;
case ROW:
cell = -1;
break;
S32 cell = item->getSelectedCell();
switch (mSelectionType)
{
case CELL:
if (cell >= 0) cell--;
break;
case HEADER:
if (cell > 1) cell--;
else if (cell == 1) cell = -1; // skip header
break;
case ROW:
cell = -1;
break;
}
item->setSelectedCell(cell);
handled = TRUE;
}
item->setSelectedCell(cell);
handled = TRUE;
}
break;
case KEY_PAGE_UP: