// leaves lines enclosed in brackets alone sS autoUnindent_honoringBrackets(S s) { LS l = lines_honoringBrackets(s); if (empty(l)) ret s; // find indent int n = Integer.MAX_VALUE; for (S line : l) n = min(n, getIndentOfLine(line)); if (n == 0) ret s; // unindent int _n = n; ret lines_possiblyRTrim(s, map(l, line -> substring(line, _n)); }