dfmt
dfmt copied to clipboard
keep_line_breaks with line limit break some chains
.\bin\dfmt.exe --keep_line_breaks=true --soft_max_line_length=120 .\test.d
unittest
{
const expectedChains = [
MyChainLinkBuilder("a").link("b").link.value,
- MyChainLinkBuilder("c").link("абвгд").link("еёжз").value,
+ MyChainLinkBuilder("c").link("абвгд")
+ .link("еёжз").value,
];
}
Not sure, what's going on here; the bug depends on the lenght of the array name, and the length of both elements.
if it's at the line limit I would expect this to line break, what did you expect otherwise?
The line has only 65 columns, but I set the limit to 120.
This happens with ASCII strings as well. Here is an example with the same behaviour:
.\bin\dfmt.exe --keep_line_breaks=true --soft_max_line_length=120 --max_line_length=120 .\test.d
unittest
{
const expectedChains = [
MyChainLinkBuilder("a").link("b").link.value,
MyChainLinkBuilder("c").link("adeddbcde").link("abdddccd").value,
];
}
But the longest line has only 73 characters.
oh in this case this is a kind-of regression with the new array formatter. Previously it would just put everything on the same line, breaking when it reaches the max line length, which is why you see a break at that point, but with the new array formatter it first tries to format each item and breaks before and after if the item, but it keeps the wrapping and doesn't try to reformat it anymore then.