Prevent trailing spaces when emitting literal strings (#1005)

This commit is contained in:
theamarin
2021-07-05 05:30:04 +02:00
committed by GitHub
parent a6bbe0e50a
commit 9ee3928754
2 changed files with 16 additions and 2 deletions

View File

@@ -366,13 +366,13 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
std::size_t indent) {
out << "|\n";
out << IndentTo(indent);
int codePoint;
for (std::string::const_iterator i = str.begin();
GetNextCodePointAndAdvance(codePoint, i, str.end());) {
if (codePoint == '\n') {
out << "\n" << IndentTo(indent);
out << "\n";
} else {
out<< IndentTo(indent);
WriteCodePoint(out, codePoint);
}
}