ux: Properly evaluate pattern changes when already evaluating
This commit is contained in:
parent
9dd555f111
commit
471ba80b4d
@ -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<std::pair<pl::LogConsole::Level, std::string>> m_console;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user