-
Notifications
You must be signed in to change notification settings - Fork 44
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
:pass rendered before indentation #66
Comments
Very interesting! Thanks for the report. First, I want to make clear that putting visible characters in a Second, I think you've indeed found a bug. Or at the very least, a design oversight. Look at the pass node logic here: Lines 195 to 196 in 29f894c
Lines 180 to 186 in 29f894c
The pass nodes don't handle producing the indent and instead write directly at column zero when that's the current position. I think it would be A-OK to copy/paste that logic down to the pass codepath. The rule would then be that passthrough text is still subject to the normal indenting policies. If you wanted to highlight the background of the indent, you'd need to insert your color commands prior to the newline character. I think the code would be: :pass
(let [text (:text node)
res* (if (zero? @column)
(do (vswap! column + indent)
(rf res (apply str (repeat indent \space))))
res)]
(rf res* text)) The only difference between the text and pass node cases would be that pass skips the If you want to give that a try and maybe add a test case, I'd be happy to accept that PR. |
Thanks so much for the thoughtful reply @brandonbloom! Yes, I should have made clear that I was Lines 292 to 294 in 29f894c
It was very kind of you to walkthrough and explain the code, I would be happy to take a stab at a PR. |
Ha! I said I would never have thought of that, but apparently I had thought of it previously :) |
Hey, at least there's comfort that you found it very clever! :-) |
Followed my understanding of guidance provided by @brandonbloom: brandonbloom#66 (comment) Closes brandonbloom#66
Followed my understanding of guidance provided by @brandonbloom: #66 (comment) Closes #66
Bumped fipp to 0.6.21 to pick up brandonbloom/fipp#66 which resolves greglook#44. To verify, beefed up ansi unit tests to include a test that almost matches example in puget README and a test that clearly shows indentation. Of note: While developing these tests I used kaocha because it has excellent expected vs actual diff reporting. Because kaocha uses puget, I figured it might not be the best idea to use kaocha for puget testing and therefore have not proposed to include it.
Hello fippsters! Thanks for your cool tool and all the hard work you've put into it!
I am new to fipp so I could very well be misunderstanding how to express myself in fipp and/or desired vs actual behavior, but here I go anyway:
Given the following code:
I get the following output:
When I was more expecting something like:
I noticed this while exploring using background colors in puget: greglook/puget#44.
The text was updated successfully, but these errors were encountered: