Skip to content

Commit

Permalink
Only update visible items when search value is empty (fluxxcode#181)
Browse files Browse the repository at this point in the history
* Only update visible items when search value is empty

* Update changelog
  • Loading branch information
fluxxcode authored Oct 27, 2024
1 parent 81909dd commit 8b1fd62
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 142 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Made default egui fonts an optional feature `default_fonts` [#163](https://github.com/fluxxcode/egui-file-dialog/pull/163) (thanks [@StarStarJ](https://github.com/StarStarJ)!)
- Filter directory when loading to improve performance [#169](https://github.com/fluxxcode/egui-file-dialog/pull/169)
- Implement non blocking directory loading [#177](https://github.com/fluxxcode/egui-file-dialog/pull/177)
- Only update visible items in the central panel if the search value is empty and the create directory dialog is currently closed [#181](https://github.com/fluxxcode/egui-file-dialog/pull/181)

### 📚 Documentation
- Updated `README.md` to include latest features [#176](https://github.com/fluxxcode/egui-file-dialog/pull/176)
Expand Down
10 changes: 10 additions & 0 deletions src/data/directory_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ impl DirectoryContent {
&self.state
}

/// Returns an iterator in the given range of the directory cotnents.
/// No filters are applied using this iterator.
pub fn iter_range_mut(
&mut self,
range: std::ops::Range<usize>,
) -> impl Iterator<Item = &mut DirectoryEntry> {
self.content[range].iter_mut()
}

pub fn filtered_iter<'s>(
&'s self,
search_value: &'s str,
Expand All @@ -293,6 +302,7 @@ impl DirectoryContent {
.filter(|p| apply_search_value(p, search_value))
}

/// Marks each element in the content as unselected.
pub fn reset_multi_selection(&mut self) {
for item in &mut self.content {
item.selected = false;
Expand Down
Loading

0 comments on commit 8b1fd62

Please sign in to comment.