1
0
mirror of synced 2024-11-25 00:00:27 +01:00

fix: Filtering search occurrences in Find view with multiple files being broken

Fixes #685
This commit is contained in:
WerWolv 2022-09-03 23:15:30 +02:00
parent 7ef11f566b
commit 0a115a3c03
2 changed files with 4 additions and 4 deletions

View File

@ -73,11 +73,11 @@ namespace hex::plugin::builtin {
std::map<prv::Provider*, std::vector<Occurrence>> m_foundOccurrences, m_sortedOccurrences;
std::map<prv::Provider*, OccurrenceTree> m_occurrenceTree;
std::map<prv::Provider*, std::string> m_currFilter;
TaskHolder m_searchTask;
bool m_settingsValid = false;
std::string m_currFilter;
private:
static std::vector<Occurrence> searchStrings(Task &task, prv::Provider *provider, Region searchRegion, SearchSettings::Strings settings);
static std::vector<Occurrence> searchSequence(Task &task, prv::Provider *provider, Region searchRegion, SearchSettings::Bytes settings);

View File

@ -524,11 +524,11 @@ namespace hex::plugin::builtin {
auto &currOccurrences = this->m_sortedOccurrences[provider];
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputTextWithHint("##filter", "hex.builtin.common.filter"_lang, this->m_currFilter)) {
this->m_sortedOccurrences = this->m_foundOccurrences;
if (ImGui::InputTextWithHint("##filter", "hex.builtin.common.filter"_lang, this->m_currFilter[provider])) {
this->m_sortedOccurrences[provider] = this->m_foundOccurrences[provider];
currOccurrences.erase(std::remove_if(currOccurrences.begin(), currOccurrences.end(), [this, provider](const auto &region) {
return !this->decodeValue(provider, region).contains(this->m_currFilter);
return !this->decodeValue(provider, region).contains(this->m_currFilter[provider]);
}), currOccurrences.end());
}
ImGui::PopItemWidth();