|
47 | 47 |
|
48 | 48 | function show_blocks(io, mime::MIME"text/plain", iter) |
49 | 49 | numlinesleft, numcols = get(io, :displaysize, displaysize(io)) |
50 | | - numlinesleft -= 2 |
51 | | - # lines of headers should already have been subtracted, but not the 2 spare lines for old and new prompts |
52 | | - minlinesperblock = 7 |
| 50 | + numlinesleft -= 2 # lines of headers have already been subtracted, but not the 2 spare lines for old and new prompts |
| 51 | + minlinesperblock = 7 # aim to have at least this many lines per printed block (= 5 lines for the actual matrix) |
53 | 52 | minnumberofblocks = min(3, length(iter)) # aim to show at least this many blocks |
54 | 53 | truncateblocks = sum(cb->min(size(cb[2], 1) + 2, minlinesperblock), iter; init = 0) > numlinesleft |
55 | 54 | maxnumlinesperblock = max(div(numlinesleft - 2 * truncateblocks, minnumberofblocks), minlinesperblock) |
56 | | - # aim to show at least 3 blocks, but not if this means that there |
57 | | - # would be less than 7 lines per block (= 5 lines for the actual matrix) |
58 | | - # we deduct a line for a truncation message depending on truncateblocks |
| 55 | + # aim to show at least minnumberofblocks, but not if this means that there would be less than minlinesperblock |
| 56 | + # deduct two lines for a truncation message (and newline) if needed |
59 | 57 | for (n, (c, b)) in enumerate(iter) |
60 | 58 | n == 1 || print(io, "\n\n") |
61 | 59 | if get(io, :limit, false) |
|
0 commit comments