kkinnear/zprint

Indentation inside namespaced maps is wrong

miridius opened this issue · 2 comments

When a namespaced map goes onto multiple lines, I've noticed 2 issues:

  1. The keys on lines after the first are indented relative to the namespace name rather than the opening {
  2. If there is another map nested inside the first one, which also goes onto multiple lines, then the lines after the first are indented the amount they would be if the enclosing map had been indented correctly. This makes them look wrong even though in some sense they're the only lines that are actually indented correctly

Example demonstrating both issues:

#:foo{:aaaaaaaaaaaaaaaaaaaaaaaa 1,
 :bbbbbbbbbbbbbbbbbbbbbbbb {:aaaaaaaaaaaaaaaaaaaaaaaa 1,
                                 :bbbbbbbbbbbbbbbbbbbbbbbb 2,
                                 :cccccccccccccccccccccccc 3},
 :cccccccccccccccccccccccc 3}

Wow, that's not good. Thank you so much for reporting this, I have no idea how this slipped by. Namespaced maps have always been a problem, in part since the parser didn't support them explicitly until fairly recently, so I had to try to work around that. Plus they don't seem to get used much, I think.

I've reproduced and possibly fixed this now. I need to do a bunch more testing before I'm sure I really got it, but I've at least found the right place to focus on. The fix for this will be in 1.2.5, which I keep thinking I'll have out soon. That said, I'm currently working on a very involved and widespread problem regarding repeatability of formatting -- where if you format a file once and then do it again, it sometimes (rarely) changes the second time. I have a good bit of work to do to finish the multiple fixes for that problem, so it will be a few weeks at best before 1.2.5 comes out.

Thanks again for noticing and reporting this!

This is fixed in 1.2.5.