const DIFFITEM &di = GetItemAt(i);
if (IsItemNavigableDiff(di))
{
- MoveSelection(currentInd, i, selCount);
+ MoveFocus(currentInd, i, selCount);
found = TRUE;
}
i++;
const DIFFITEM &di = GetItemAt(i);
if (IsItemNavigableDiff(di))
{
- MoveSelection(currentInd, i, selCount);
+ MoveFocus(currentInd, i, selCount);
found = TRUE;
}
i--;
const DIFFITEM &di = GetItemAt(i);
if (IsItemNavigableDiff(di))
{
- MoveSelection(currentInd, i, selCount);
+ MoveFocus(currentInd, i, selCount);
found = TRUE;
}
i++;
const DIFFITEM &di = GetItemAt(i);
if (IsItemNavigableDiff(di))
{
- MoveSelection(currentInd, i, selCount);
+ MoveFocus(currentInd, i, selCount);
found = TRUE;
}
i--;
return true;
}
-// move focus (& selection if only one selected) from currentInd to i
-void CDirView::MoveSelection(int currentInd, int i, int selCount)
+/**
+ * @brief Move focus to specified item (and selection if multiple items not selected)
+ *
+ * Moves the focus from item [currentInd] to item [i]
+ * Additionally, if there are not multiple items selected,
+ * deselects item [currentInd] and selects item [i]
+ */
+void CDirView::MoveFocus(int currentInd, int i, int selCount)
{
if (selCount <= 1)
{
+ // Not multiple items selected, so bring selection with us
m_pList->SetItemState(currentInd, 0, LVIS_SELECTED);
m_pList->SetItemState(currentInd, 0, LVIS_FOCUSED);
m_pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
}
+ // Move focus to specified item
+ // (this automatically defocuses old item)
m_pList->SetItemState(i, LVIS_FOCUSED, LVIS_FOCUSED);
m_pList->EnsureVisible(i, FALSE);
}
if (GetOptionsMgr()->GetBool(OPT_SCROLL_TO_FIRST))
OnFirstdiff();
else
- MoveSelection(0, 0, 0);
+ MoveFocus(0, 0, 0);
return 0; // return value unused
}