Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print: accurately track (fractional) line width, and raise the max width back to 120. #37

Merged
merged 6 commits into from
Jun 11, 2023

Conversation

eddyb
Copy link
Contributor

@eddyb eddyb commented Jun 11, 2023

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 our font-sizes are always integer multiples of 0.1em).

The result is much more accurate, and so far appears to perfectly match browser behavior (i.e. the transition of MAX_LINE_WIDTH from N-1 to N, where multi-line layout gets replaced with single-line layout, results in a line that "tightly fits" in a max-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).

@eddyb eddyb enabled auto-merge June 11, 2023 00:41
@eddyb eddyb added this pull request to the merge queue Jun 11, 2023
Merged via the queue into main with commit c11d384 Jun 11, 2023
@eddyb eddyb deleted the print-accurate-width branch June 11, 2023 00:50
eddyb added a commit that referenced this pull request Jun 13, 2023
…printed SPIR-T is up to date in CI. (#34)

*Originally found while working on #33, and also used to contain #37
before splitting that off.*

The pretty-printing fix here (not showing `OpTypePointer` that are used
internally in `GlobalVarDecl`/`PtrToGlobalVar` but never actually meant
to be printed) is relatively small, the main change is the new CI check,
which should ensure we don't forget to update `README.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant