static S structTokWordWrap(S s) { ret structTokWordWrap(120, s); } // TODO: complete trimming static S structTokWordWrap(int cols, S s) { int col = 0; L tok = structTok(s); for (int i = 0; i < l(tok); i++) { S t = tok.get(i); if (odd(i) && col >= cols && !containsNewLine(t)) tok.set(i, t = rtrimSpaces(t) + "\n"); int idx = t.lastIndexOf('\n'); if (idx >= 0) col = l(t)-(idx+1); else col += l(t); } ret join(tok); }