| 302 | } |
| 303 | |
| 304 | void FormatBuilder::AddEndOfLine(std::size_t line) { |
| 305 | auto endOfLine = _state.GetEndOfLine(); |
| 306 | switch (endOfLine) { |
| 307 | case EndOfLine::CRLF: { |
| 308 | if (line == 1) { |
| 309 | _formattedText.push_back('\r'); |
| 310 | _formattedText.push_back('\n'); |
| 311 | } else { |
| 312 | auto index = _formattedText.size(); |
| 313 | _formattedText.resize(index + 2 * line, '\n'); |
| 314 | for (; index < _formattedText.size(); index += 2) { |
| 315 | _formattedText[index] = '\r'; |
| 316 | } |
| 317 | } |
| 318 | break; |
| 319 | } |
| 320 | case EndOfLine::CR: { |
| 321 | if (line == 1) { |
| 322 | _formattedText.push_back('\r'); |
| 323 | } else { |
| 324 | _formattedText.resize(_formattedText.size() + line, '\r'); |
| 325 | } |
| 326 | break; |
| 327 | } |
| 328 | case EndOfLine::UNKNOWN: |
| 329 | case EndOfLine::MIX: |
| 330 | case EndOfLine::LF: { |
| 331 | if (line == 1) { |
| 332 | _formattedText.push_back('\n'); |
| 333 | } else { |
| 334 | _formattedText.resize(_formattedText.size() + line, '\n'); |
| 335 | } |
| 336 | break; |
| 337 | } |
| 338 | } |
| 339 | _state.CurrentWidth() = 0; |
| 340 | } |
| 341 | |
| 342 | void FormatBuilder::WriteLine(std::size_t line) { |
| 343 | if (line == 0) { |
nothing calls this directly
no test coverage detected