concept G22LeftArrowScript > ConceptWithChangeListeners { settableWithVar S description; // the script (last "saved" version) settableWithVar S text; // the latest code that has been cleared to auto-run (if any) settableWithVar ClearForAutoRun clearedForAutoRun; // text currently being modified in an editor (or null) // Note that "" doesn't count as null. settableWithVar S editingText; @Override void _doneLoading2() { //print("_doneLoading " + this); cMigrateField(this, "code", "text"); } S myType() { ret dropPrefix("G22", shortClassName(this)); } toString { ret or2(description, myType() + " " + id); } void initEditingText { editingText(unnull(or(editingText, text))); } S stableText() { ret text; } void completeEdit aka save() { S t = editingText; if (t != null) { text(t); editingText(null); } } S textForEditing() { initEditingText(); ret editingText; } File historyFile() { ret fileInConceptsDir("History/" + shortDynName(this) + id + ".history"); } void saveTextToHistory() { saveFieldToHistory("text", text); } void saveFieldToHistory(S field, S value) { if (value == null) ret; File historyFile = assertNotNull(+historyFile()); appendToTextFile(historyFile, "\n===\n" + "Concept ID: " + id + "\n" + "Date: " + dateWithMSUTC() + "\n" + firstToUpper(field) + " (" + nLines(value) + ", " + nChars(value) + "):\n" + indentx(value) + "\n" + "\n" + "===" + "\n"); } }