* @brief Reformats one line based on its scanner state, brace depth and hanging indent. */
| 628 | * @brief Reformats one line based on its scanner state, brace depth and hanging indent. |
| 629 | */ |
| 630 | static QString reformatOne( |
| 631 | const QString& raw, const LineInfo& info, int depthAtStart, int hangAtStart, int indentSpaces) |
| 632 | { |
| 633 | QString trimmed = rtrim(raw); |
| 634 | |
| 635 | if (info.startsInsideMultiline) |
| 636 | return trimmed; |
| 637 | |
| 638 | const int lead = leadingWhitespaceCount(QStringView(trimmed)); |
| 639 | if (lead == trimmed.size()) |
| 640 | return QString(); |
| 641 | |
| 642 | const QString body = trimmed.mid(lead); |
| 643 | return computeIndent(depthAtStart + hangAtStart, info.outdentLeading, indentSpaces) + body; |
| 644 | } |
| 645 | |
| 646 | namespace DataModel::CodeFormatter { |
| 647 |
no test coverage detected