Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sections for repeated searches #74

Merged
merged 4 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/de.leopoldluley.Clapgrep.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</ul>
<p>Bug fixes:</p>
<ul>
<li>None yet.</li>
<li>Repeated searches now display their results correctly again.</li>
</ul>
</description>
</release>
Expand Down
8 changes: 4 additions & 4 deletions gnome/src/search/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl SearchModel {
let imp = self.imp();
let len = imp.data.borrow().len();
imp.data.borrow_mut().clear();
imp.sections.borrow_mut().clear();
self.items_changed(0, len as u32, 0)
}

Expand All @@ -50,9 +51,6 @@ impl SearchModel {
data.extend(search_results);
let end = data.len() as u32;

drop(data);
drop(base_path);

let section = Section { start, end };
self.imp().sections.borrow_mut().push(section);

Expand All @@ -67,7 +65,9 @@ impl SearchModel {
pub fn extend_with_results(&self, results: &[clapgrep_core::SearchResult]) {
let start = self.imp().data.borrow().len() as u32;
for file_info in results {
self.append_file_info_impl(file_info);
if !file_info.entries.is_empty() {
self.append_file_info_impl(file_info);
}
}
let end = self.imp().data.borrow().len() as u32;

Expand Down