Fix Quick Open history

(cherry picked from commit be53dd3d04)
This commit is contained in:
kobewi
2025-09-30 14:26:14 +02:00
committed by Rémi Verschelde
parent a5fa61bcfe
commit 0234028f7c

View File

@ -521,18 +521,28 @@ void QuickOpenResultContainer::update_results() {
} }
void QuickOpenResultContainer::_use_default_candidates() { void QuickOpenResultContainer::_use_default_candidates() {
HashSet<String> existing_paths;
Vector<QuickOpenResultCandidate> *history = _get_history(); Vector<QuickOpenResultCandidate> *history = _get_history();
if (history) { if (history) {
candidates.append_array(*history); candidates.append_array(*history);
for (const QuickOpenResultCandidate &candi : *history) {
existing_paths.insert(candi.file_path);
}
} }
int i = candidates.size();
candidates.resize(MIN(max_total_results, filepaths.size())); candidates.resize(MIN(max_total_results, filepaths.size()));
QuickOpenResultCandidate *candidates_w = candidates.ptrw();
int count = candidates.size(); int count = candidates.size();
int i = 0;
for (const String &filepath : filepaths) { for (const String &filepath : filepaths) {
if (i >= count) { if (i >= count) {
break; break;
} }
_setup_candidate(candidates.write[i++], filepath); if (existing_paths.has(filepath)) {
continue;
}
_setup_candidate(candidates_w[i++], filepath);
} }
} }