Skip to content

Commit bd139cc

Browse files
committed
fix broken reloading of revlog on new search results
1 parent e0bc518 commit bd139cc

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/components/commitlist.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl CommitList {
225225
///
226226
pub fn set_commits(&mut self, commits: Vec<CommitId>) {
227227
self.commits = commits;
228-
self.fetch_commits();
228+
self.fetch_commits(false);
229229
}
230230

231231
///
@@ -237,7 +237,7 @@ impl CommitList {
237237
let selection_max = self.selection_max();
238238

239239
if self.needs_data(selection, selection_max) || new_commits {
240-
self.fetch_commits();
240+
self.fetch_commits(false);
241241
}
242242
}
243243

@@ -246,10 +246,20 @@ impl CommitList {
246246
&mut self,
247247
highlighting: Option<Rc<IndexSet<CommitId>>>,
248248
) {
249-
self.highlights = highlighting;
249+
//note: set highlights to none if there is no highlight
250+
self.highlights = if highlighting
251+
.as_ref()
252+
.map(|set| set.is_empty())
253+
.unwrap_or_default()
254+
{
255+
None
256+
} else {
257+
highlighting
258+
};
259+
250260
self.select_next_highlight();
251261
self.set_highlighted_selection_index();
252-
self.fetch_commits();
262+
self.fetch_commits(true);
253263
}
254264

255265
///
@@ -713,7 +723,7 @@ impl CommitList {
713723
self.items.needs_data(idx, idx_max)
714724
}
715725

716-
fn fetch_commits(&mut self) {
726+
fn fetch_commits(&mut self, force: bool) {
717727
let want_min =
718728
self.selection().saturating_sub(SLICE_SIZE / 2);
719729
let commits = self.commits.len();
@@ -725,6 +735,7 @@ impl CommitList {
725735
.index_offset_raw()
726736
.map(|index| want_min == index)
727737
.unwrap_or_default()
738+
|| force
728739
{
729740
let slice_end =
730741
want_min.saturating_add(SLICE_SIZE).min(commits);

0 commit comments

Comments
 (0)