fix(overview): mining addresses visible at 0 balance; drag-reorder always applies
- Address list: a mining-flagged address stays visible even at 0 balance when "hide zero balances" is on (payout addresses shouldn't vanish). - Drag-reorder: persist dense sort orders (0..N-1) for the whole visible list on drop via App::reorderAddresses, instead of a pairwise swap that no-ops when both rows are still at the default un-ordered state. First drag now always takes effect, and explicit order keeps overriding the starred/type/balance sort. - Tests: 0-balance mining row survives hide-zero; ordered non-favorite outranks a favorite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -343,12 +343,20 @@ void RenderSharedAddressList(App* app, float listH, float availW,
|
||||
for (int i = 0; i < (int)rows.size(); ++i) {
|
||||
if (mousePos.y > rowY[i] + rowH * 0.5f) insertIdx = i + 1;
|
||||
}
|
||||
if (insertIdx != s_dragIdx && insertIdx != s_dragIdx + 1) {
|
||||
int targetIdx = (insertIdx > s_dragIdx) ? insertIdx - 1 : insertIdx;
|
||||
if (targetIdx >= 0 && targetIdx < (int)rows.size() && s_dragIdx < (int)rows.size()) {
|
||||
app->swapAddressOrder(rows[s_dragIdx].info->address,
|
||||
rows[targetIdx].info->address);
|
||||
}
|
||||
if (insertIdx != s_dragIdx && insertIdx != s_dragIdx + 1 &&
|
||||
s_dragIdx < (int)rows.size()) {
|
||||
// Build the new visible order (move the dragged row to insertIdx) and
|
||||
// persist dense sort orders 0..N-1 in one shot. This works even when the
|
||||
// rows were still at the default order (a pairwise swap would no-op).
|
||||
std::vector<std::string> newOrder;
|
||||
newOrder.reserve(rows.size());
|
||||
for (int i = 0; i < (int)rows.size(); ++i)
|
||||
if (i != s_dragIdx) newOrder.push_back(rows[i].info->address);
|
||||
int clamped = std::min(insertIdx, (int)rows.size());
|
||||
int destIdx = (insertIdx > s_dragIdx) ? clamped - 1 : clamped;
|
||||
destIdx = std::max(0, std::min(destIdx, (int)newOrder.size()));
|
||||
newOrder.insert(newOrder.begin() + destIdx, rows[s_dragIdx].info->address);
|
||||
app->reorderAddresses(newOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user