astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

Fix #137 : Formatting alignments in math panics. #140

Closed WannesMalfait closed 10 months ago

WannesMalfait commented 10 months ago

The problem was that the code assumed that each line had the same number of alignment points. When this is not the case, formatting one alignment point can cause a shift in other alignment points beyond the previously calculated position. The code now precalculates the shifts that happen due to aligning the alignment points.

This also adds two new tests which ensure that the alignment behaves as expected, even in weird edge cases.

astrale-sharp commented 10 months ago

Amazing, thank you very much :D