scope renderLineCompedSingleLevels. sS renderLineCompedSingleLevels(LineCompedSingle lc) { int n = lcLength(lc); // each byte is the character's "color" // (0 for empty, 1 for color one, 2 for color two) L rows = new AutoGrowingList<>(() -> new byte[n]); S text = lcString(lc); fill(lc, rows, 0, 0, lc.main, 1); ret lines(map(rows, row -> { StringBuilder buf = new(n); for i to n: { char c = text.charAt(i); buf.append(c); if (i < n) buf.append(row[i] != 0 && row[i+1] != 0 && row[i] != row[i+1] ? '|' : ' '); } ret str(buf); }); } // returns new x static int #fill(LineCompedSingle lc, L rows, int x, int y, L symbols, int color) { for (int idx : symbols) { if (idx < l(lc.literals)) { // nothing to do? ret x+1; } else { int newX = fill(lc, rows, x, y+1, idx, color); while (x < newX) rows.get(y)[x++] = color; color = 3-color; } } ret x; } end scope