Skip to content

Commit b027269

Browse files
committed
Improved select performance.
1 parent caa2500 commit b027269

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

nui-file-explorer/include/nui-file-explorer/item_with_internals.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ namespace NuiFileExplorer
3131

3232
void isSelected(bool value)
3333
{
34-
*selected_ = value;
34+
if (selected_->value() != value)
35+
*selected_ = value;
3536
}
3637

3738
explicit ItemWithInternals(Item const& item)

nui-file-explorer/source/nui-file-explorer/side/selection_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ namespace NuiFileExplorer
134134
const bool selected = (inRange(i) && ctrlRemove_.count(i) == 0) || ctrlAdd_.count(i) > 0;
135135
vec[i].isSelected(selected);
136136
}
137-
items_->modifyNow();
137+
Nui::globalEventContext.sync();
138138
}
139139

140140
// =========================================================================
@@ -154,7 +154,7 @@ namespace NuiFileExplorer
154154
loseTrackToAllSelections();
155155
for (auto& item : items_->value())
156156
item.isSelected(false);
157-
items_->modifyNow();
157+
Nui::globalEventContext.sync();
158158
}
159159

160160
void SelectionManager::selectAll()

0 commit comments

Comments
 (0)