I've been carrying this issue around since v0.2, basically what it means is when you have curly braces ({,}) which are not related to your code's structure (stuff like private string _foo = "lala}la";) it tips the balance of the rest of the structural brackets.
So if the following class was declared
1: public class Foo
2: { 3: string bar = "}";
4: }
Regionerate would have identified this as the entire class
1: public class Foo
2: { 3: string bar="}
Pretty annoying, I agree, but now I have found a solution for it.
Prior to construction, all curly braces which are inside string literals are replaced to {?} where ? is an angle bracket pointing at the original bracket.
For example,
1: private string _foo = "{";would turn into
1: private string _foo = "{<}";and
1: private string _bar = "}";
would turn into
1: private string _bar = "{>}";
This helps to keep the balance at all situations. After layout is applied the original code is fully restored.
This seems like a hack, but I don't think of it as one, as it does not interfere with anything else and Regionerate will never get around to constructing string literals so this will not impose any limitations in the future.
Labels: Bug Fixes, Public Beta, v0.6, v0.6.6.5