From 336726b16b0fb90dcb93498a1c6cffb9e18cdf04 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 1 Jun 2008 01:29:13 +0000 Subject: [PATCH] The keyword reminder text box now tries to run the script to see if it contains errors git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@932 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/data/action/keyword.cpp | 31 ++++++++++++++++++++++++++----- src/data/action/keyword.hpp | 7 ++++++- src/gui/set/keywords_panel.cpp | 2 +- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/data/action/keyword.cpp b/src/data/action/keyword.cpp index bf325238..23ec0229 100644 --- a/src/data/action/keyword.cpp +++ b/src/data/action/keyword.cpp @@ -52,8 +52,10 @@ void AddKeywordAction::perform(bool to_undo) { // ----------------------------------------------------------------------------- : Changing keywords -KeywordReminderTextValue::KeywordReminderTextValue(const TextFieldP& field, Keyword* keyword, bool editable) +KeywordReminderTextValue::KeywordReminderTextValue(Set& set, const TextFieldP& field, Keyword* keyword, bool editable) : KeywordTextValue(field, keyword, &keyword->reminder.getUnparsed(), editable) + , set(set) + , keyword(*keyword) {} void KeywordReminderTextValue::store() { @@ -67,10 +69,12 @@ void KeywordReminderTextValue::store() { vector parse_errors; ScriptP new_script = parse(new_value, nullptr, true, parse_errors); if (parse_errors.empty()) { - // parsed okay, assign - errors.clear(); - keyword.reminder.getScriptP() = new_script; - keyword.reminder.getUnparsed() = new_value; + // parsed okay + if (checkScript(new_script)) { + // also runs okay, assign + keyword.reminder.getScriptP() = new_script; + keyword.reminder.getUnparsed() = new_value; + } } else { // parse errors, report errors = ScriptParseErrors(parse_errors).what(); @@ -172,6 +176,23 @@ void KeywordReminderTextValue::highlight(const String& code, const vector