!7 cmodule LiveCompressor { switchable int nPredictions = 5; switchable bool optimize; S input, output, prediction; transient new LCStreamingCompressor comp; transient S compressedText; visual centerAndSouth(jvsplit( dm_textAreaAsSection input(), dm_textAreaAsSection output()), dm_labelAsSection prediction()); start { dm_onFieldChangeAndNow input(r calc); } void calc { S input = this.input; new Matches m; if (optimize && startsWith(input, compressedText, m)) comp.append(m.rest()); else { comp = new LCStreamingCompressor; comp.append(input); } compressedText = input; setField(output := lcStream_textWithBrackets(comp)); setField(prediction := join(lcStream_repeatedPrediction2(nPredictions, comp))); } }