| 106 | NeedSpace = true; |
| 107 | } |
| 108 | void Break() |
| 109 | { |
| 110 | // Don't break if not needed. |
| 111 | if (Column != NestDepth) |
| 112 | { |
| 113 | if (NeedSpace) |
| 114 | { |
| 115 | ConsecOpens = 0; |
| 116 | } |
| 117 | else |
| 118 | { // Move hanging ( characters to the new line |
| 119 | Str.Truncate(Str.Len() - ConsecOpens); |
| 120 | NestDepth -= ConsecOpens; |
| 121 | } |
| 122 | Str << '\n'; |
| 123 | Column = NestDepth; |
| 124 | NeedSpace = false; |
| 125 | if (NestDepth > 0) |
| 126 | { |
| 127 | Str.AppendFormat("%*s", (int)NestDepth, ""); |
| 128 | } |
| 129 | if (ConsecOpens > 0) |
| 130 | { |
| 131 | for (size_t i = 0; i < ConsecOpens; ++i) |
| 132 | { |
| 133 | Str << '('; |
| 134 | } |
| 135 | NestDepth += ConsecOpens; |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | bool CheckWrap(size_t len) |
| 140 | { |
| 141 | if (len + Column > WrapWidth) |
no test coverage detected