1
0
mirror of synced 2025-02-07 06:31:24 +01:00

fix: Properly clear pattern editor when all providers are closed

This commit is contained in:
WerWolv 2023-06-06 10:36:02 +02:00
parent 48022bc295
commit 1e2cf87532

View File

@ -104,6 +104,7 @@ namespace hex::plugin::builtin {
EventManager::unsubscribe<EventProviderOpened>(this);
EventManager::unsubscribe<RequestChangeTheme>(this);
EventManager::unsubscribe<EventProviderChanged>(this);
EventManager::unsubscribe<EventProviderClosed>(this);
}
void ViewPatternEditor::drawContent() {
@ -871,6 +872,12 @@ namespace hex::plugin::builtin {
this->m_hasUnevaluatedChanges = true;
}
});
EventManager::subscribe<EventProviderClosed>(this, [this](prv::Provider *) {
if (this->m_syncPatternSourceCode && ImHexApi::Provider::getProviders().empty()) {
this->m_textEditor.SetText("");
}
});
}
static void createNestedMenu(const std::vector<std::string> &menus, const std::function<void()> &function) {