From 696d60c18bb0fae9a5a6e5ccbbd6d77acdc5bd58 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 25 Jan 2022 00:17:43 +0000 Subject: [PATCH] Fix text editor not saving updated text Signed-off-by: falkTX --- plugins/Cardinal/src/TextEditor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Cardinal/src/TextEditor.cpp b/plugins/Cardinal/src/TextEditor.cpp index 3a5b8c5..a9d1d09 100644 --- a/plugins/Cardinal/src/TextEditor.cpp +++ b/plugins/Cardinal/src/TextEditor.cpp @@ -47,7 +47,12 @@ struct TextEditorModule : Module { json_t* dataToJson() override { - json_t* rootJ = json_object(); + json_t* const rootJ = json_object(); + DISTRHO_SAFE_ASSERT_RETURN(rootJ != nullptr, nullptr); + + if (ImGuiTextEditor* const widget = widgetPtr) + text = widget->getText(); + json_object_set_new(rootJ, "filepath", json_string(file.c_str())); json_object_set_new(rootJ, "lang", json_string(lang.c_str())); json_object_set_new(rootJ, "etext", json_string(text.c_str()));