fix: Pattern Editor content getting reset to default comment when opening new data source

(cherry picked from commit 6d976fb785)
This commit is contained in:
WerWolv
2025-12-25 19:55:12 +01:00
parent 38a59aff20
commit c74c123e44

View File

@@ -310,7 +310,10 @@ namespace hex::plugin::builtin {
this->registerHandlers();
// Initialize the text editor with some basic help text
m_textEditor.setOnCreateCallback([](auto, ui::TextEditor &editor) {
m_textEditor.setOnCreateCallback([this](prv::Provider *provider, ui::TextEditor &editor) {
if (m_sourceCode.isSynced() && !m_sourceCode.get(provider).empty())
return;
std::string text = "hex.builtin.view.pattern_editor.default_help_text"_lang;
text = "// " + wolv::util::replaceStrings(text, "\n", "\n// ");