print: accurately track (fractional) line width, and raise the max width back to 120. #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Originally found/fixed during the #33/#34/#35/#36 series of pretty-printing PRs.
Before this PR, we were treating all text the same, regardless of style, but this PR introduces the concept of "fractional columns" (integer multiples of
0.1ch
, because ourfont-size
s are always integer multiples of0.1em
).The result is much more accurate, and so far appears to perfectly match browser behavior (i.e. the transition of
MAX_LINE_WIDTH
fromN-1
toN
, where multi-line layout gets replaced with single-line layout, results in a line that "tightly fits" in amax-width: Nch
container, with no spurious gaps or overflows).Note however that the increased accuracy makes the layout favor HTML over plaintext (and we don't have a plaintext-vs-HTML "simultaneous layout", nor a way to hint what the output of pretty layout will be used for), so the plaintext output may feel more inconsistent as a result (but its aesthetics are of dubious value anyway).