| Index: tools/gn/command_format.cc
|
| diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc
|
| index a8143ffb8eb24585c35a8481638bb1ae39dfe109..81424ab7a445a291b02ba0caefc2b5a21d7a573b 100644
|
| --- a/tools/gn/command_format.cc
|
| +++ b/tools/gn/command_format.cc
|
| @@ -80,9 +80,8 @@ enum Precedence {
|
| };
|
|
|
| int CountLines(const std::string& str) {
|
| - std::vector<std::string> lines;
|
| - base::SplitStringDontTrim(str, '\n', &lines);
|
| - return static_cast<int>(lines.size());
|
| + return static_cast<int>(base::SplitStringPiece(
|
| + str, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL).size());
|
| }
|
|
|
| class Printer {
|
| @@ -394,8 +393,8 @@ void Printer::Block(const ParseNode* root) {
|
|
|
| int Printer::AssessPenalty(const std::string& output) {
|
| int penalty = 0;
|
| - std::vector<std::string> lines;
|
| - base::SplitStringDontTrim(output, '\n', &lines);
|
| + std::vector<std::string> lines = base::SplitString(
|
| + output, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
|
| penalty += static_cast<int>(lines.size() - 1) * GetPenaltyForLineBreak();
|
| for (const auto& line : lines) {
|
| if (line.size() > kMaximumWidth)
|
| @@ -405,9 +404,8 @@ int Printer::AssessPenalty(const std::string& output) {
|
| }
|
|
|
| bool Printer::ExceedsMaximumWidth(const std::string& output) {
|
| - std::vector<std::string> lines;
|
| - base::SplitStringDontTrim(output, '\n', &lines);
|
| - for (const auto& line : lines) {
|
| + for (const auto& line : base::SplitString(
|
| + output, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) {
|
| if (line.size() > kMaximumWidth)
|
| return true;
|
| }
|
|
|