Closed jamuir closed 7 years ago
looks great, thank you very much, but it doesn't cover case isAllowWhitespace() = true ? if a user turns on the mode (through /ES) then he will get unexpected behaviour
Good point.
I thought it was safe to ignore the "/ES" switch, but if you specify both "/ES" and "/PI" then "//$" won't get replaced with three spaces.
I think I know how to fix this. I will update the PR.
cheers.
Another approach would be to not allow both "/ES" and "/PI" to be specified. If I cannot figure out a good way to implement "/ES" and "/PI" together, then I will use that as my Plan B :-)
@raydac: I've updated the PR.
Now when /PI is specified, a dollar-sign prefix string s
will be replaced with a string composed of s.length()
spaces. E.g. when both /PI and /ES are set, then
"// $$" is replaced with 7 spaces
"// $" is replaced with 4 spaces
"//$$" is replaced with 4 spaces
"//$" is replaced with 3 spaces
and so on.
Use /PI to tell JCP to preserve line indentation when processing line-prefixes //$ and //$$. When /PI is specified, then "//$" gets replaced with three spaces, and "//$$" gets replaced with four spaces.