feat(wallets): pin the active wallet to the top of the list
Make "is the active wallet" the primary sort key so the current wallet always stays at the top regardless of the chosen sort/direction; the remaining wallets sort by the selected key underneath it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,7 +155,10 @@ public:
|
||||
default: sortVal[k] = pr.createdEpoch; break; // 0 = date created
|
||||
}
|
||||
}
|
||||
auto isActive = [&](std::size_t i) { return s_rows[i].inDatadir && s_rows[i].fileName == active; };
|
||||
std::stable_sort(s_order.begin(), s_order.end(), [&](std::size_t a, std::size_t b) {
|
||||
const bool aa = isActive(a), ba = isActive(b);
|
||||
if (aa != ba) return aa; // the active wallet is always pinned to the top
|
||||
return s_sortDesc ? sortVal[a] > sortVal[b] : sortVal[a] < sortVal[b];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user