diff --git a/include/views/view_pattern_editor.hpp b/include/views/view_pattern_editor.hpp index d53ece472..7b7117d7e 100644 --- a/include/views/view_pattern_editor.hpp +++ b/include/views/view_pattern_editor.hpp @@ -30,6 +30,7 @@ namespace hex { int m_selectedPatternFile = 0; bool m_runAutomatically = false; bool m_evaluatorRunning = false; + bool m_hasUnevaluatedChanges = false; TextEditor m_textEditor; std::vector> m_console; diff --git a/source/views/view_pattern_editor.cpp b/source/views/view_pattern_editor.cpp index dd82a258f..1715901cf 100644 --- a/source/views/view_pattern_editor.cpp +++ b/source/views/view_pattern_editor.cpp @@ -246,13 +246,21 @@ namespace hex { if (this->m_evaluatorRunning) ImGui::TextSpinner("hex.view.pattern.evaluating"_lang); else - ImGui::Checkbox("hex.view.pattern.auto"_lang, &this->m_runAutomatically); + if (ImGui::Checkbox("hex.view.pattern.auto"_lang, &this->m_runAutomatically)) { + if (this->m_runAutomatically) + this->m_hasUnevaluatedChanges = true; + } if (this->m_textEditor.IsTextChanged()) { if (this->m_runAutomatically) - this->parsePattern(this->m_textEditor.GetText().data()); + this->m_hasUnevaluatedChanges = true; + } + if (this->m_hasUnevaluatedChanges && !this->m_evaluatorRunning) { + this->m_hasUnevaluatedChanges = false; ProjectFile::markDirty(); + + this->parsePattern(this->m_textEditor.GetText().data()); } }