Fix Choice down spacing
Closed this issue · 3 comments
Nice library!
I noticed a problem in the Python package and have a fix for it (PR to follow). Here's a diagram which shows the problem:
from railroad import Choice, Diagram, Group, Skip, Stack, Terminal
diagram = Diagram(
Choice(
0,
Group(Choice(0, Skip(), Group(Stack(Terminal("abc"), Skip()), "inner")), "top"),
Terminal("xyz"),
)
)
With the current latest commit in this repo, it looks like:
I think the down
spacing of Choice
is where the problem lies. After fixing it it looks like this:
I'm not sure how to run the tests in this repo so I just got this working with the above example and haven't checked whether it breaks anything else.
Hm, looking at the code now, I'm pretty sure it's wronger than what #107 is fixing. I'll take a deeper look at this tomorrow.
And yup, the code was still making a lot of assumptions that predated the introduction of the "height" concept. All fixed now!
Thanks for the quick fix, looks good!