Restore newlines when writing Bstrs#161
Restore newlines when writing Bstrs#161epage merged 5 commits intoassert-rs:masterfrom smoelius:restore-newlines
Bstrs#161Conversation
Address @tailhook's feedback in #161 (comment)
|
I pushed a commit to address @tailhook's feedback. Regarding:
I think this point is perfectly valid, but I also think there are a wide range of heuristics that could be applied. So, assuming this feature is merged, maybe it would be better to let people use it first and see how it behaves on real-world data(?). |
|
Okay. But I also think NewlineRestorer is a bit more complex than needed. Why not format the same as in the "too many lines" case, but don't omit lines? |
Because I had tunnel vision. :| How's this? |
|
Looks good, just two tweaks.
But now let maintainers of the repo chime in first. /cc @epage |
@epage Should I implement this? |
Considering we elide output today, I would not consider it a blocker for this but something we can discuss in a new issue. |
|
Thanks! |
Address @tailhook's feedback in assert-rs#161 (comment)
Restore newlines when writing `Bstr`s
Fixes #137 (cc: @tailhook)
I implemented 6 from #137 (comment), since that seemed to be closest in spirit to the code that was already there.
Note: if a piece of text meets both the "too many lines" and "too many bytes" conditions, the former takes precedence, i.e., I display the text by omitting lines rather than bytes. My reasoning is: if a piece of text meets the "too many lines" condition, it is likely to also meet the "too many bytes" condition. In other words, if you didn't do it this way, this enhancement would almost never apply. The downside to this choice is that it could allow really long lines.