Warning: session_start(): open(/var/lib/php/sessions/sess_7jsstu3t24mkp3d244mkl26m3a, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule TextAssist > DynPrintLogAndEnabled {
int moduleID = 576; // editor ID, XXX
S lastText;
start {
doEvery(1.0, r check);
}
void check {
S text = cast dm_rcall getText(moduleID);
pcall {
compareTexts(lastText, text);
}
setField(lastText := text);
}
void compareTexts(S lastText, S text) {
LS linesA = lines(lastText);
LS linesB = lines(text);
// need same number of lines
if (l(linesA) != l(linesB)) ret with print("Line count changed, exiting");
L indices = differingIndices(linesA, linesB);
if (l(indices) != 1) ret with print("# changed lines: " + l(indices) + ", exiting");
int i = first(indices);
S oldLine = linesA.get(i), newLine = linesB.get(i);
// Make a TextEdit to see what is changed in line
TextEdit edit = createTextEdit(oldLine, newLine);
if (edit == null) ret with print("Line not changed? Weird.");
print("Have text edit in line " + i + ": " + edit);
}
}