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.
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.