1
0
mirror of synced 2024-11-28 01:20:51 +01:00

fix: Data inspector not updating correctly when data has changed

Fixes #1545
This commit is contained in:
WerWolv 2024-02-15 13:01:34 +01:00
parent e016c8a702
commit 2f88994c37
3 changed files with 10 additions and 2 deletions

View File

@ -33,8 +33,10 @@ namespace hex::prv::undo {
template<std::derived_from<Operation> T>
bool add(auto && ... args) {
auto result = this->add(std::make_unique<T>(std::forward<decltype(args)>(args)...));
EventDataChanged::post(m_provider);
return this->add(std::make_unique<T>(std::forward<decltype(args)>(args)...));
return result;
}
bool add(std::unique_ptr<Operation> &&operation);

View File

@ -29,8 +29,10 @@ namespace hex::plugin::builtin {
};
private:
void invalidateData();
void updateInspectorRows();
private:
bool m_shouldInvalidate = true;

View File

@ -24,7 +24,6 @@ namespace hex::plugin::builtin {
ViewDataInspector::ViewDataInspector() : View::Window("hex.builtin.view.data_inspector.name", ICON_VS_INSPECT) {
// Handle region selection
EventRegionSelected::subscribe(this, [this](const auto &region) {
// Save current selection
if (!ImHexApi::Provider::isValid() || region == Region::Invalid()) {
m_validBytes = 0;
@ -39,6 +38,11 @@ namespace hex::plugin::builtin {
m_shouldInvalidate = true;
});
EventDataChanged::subscribe(this, [this](const auto &provider) {
if (provider == m_selectedProvider)
m_shouldInvalidate = true;
});
EventProviderClosed::subscribe(this, [this](const auto*) {
m_selectedProvider = nullptr;
});