!7 cmodule DiffTwoTexts { S text1, text2; S diff; switchable bool trim = true; visual centerAndSouth(hgridWithSpacing( //jhsplit3( withTitle("Text A (-)", dm_textArea text1()), withTitle("Diff", withMargin(wrap(dm_textArea diff()))), withTitle("Text B (+)", dm_textArea text2())), centeredLine(setToolTip("Also ignores empty lines", dm_checkBox("Ignore Indent", 'trim)))); start { dm_watchFields(ll("text1", "text2", "trim"), r doDiff); } void doDiff enter { setField(diff := unidiff(preprocess(text1), preprocess(text2))); } S preprocess(S s) { if (trim) s = fullTrim(s); ret s; } }