diff options
Diffstat (limited to 'tools/gn/command_format.cc')
-rw-r--r-- | tools/gn/command_format.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc index 96170b2..0a110f1 100644 --- a/tools/gn/command_format.cc +++ b/tools/gn/command_format.cc @@ -122,14 +122,22 @@ void Printer::Newline() { if (!comments_.empty()) { Print(" "); int i = 0; + // Save the margin, and temporarily set it to where the first comment + // starts so that multiple suffix comments are vertically aligned. This + // will need to be fancier once we enforce 80 col. + int old_margin = margin_; for (const auto& c : comments_) { - if (i > 0) { + if (i == 0) + margin_ = CurrentColumn(); + else { Trim(); Print("\n"); PrintMargin(); } TrimAndPrintToken(c); + ++i; } + margin_ = old_margin; comments_.clear(); } Trim(); |