Prevent trailing spaces when emitting literal strings
This behavior matches the format expectations of the Red Hat yaml language server.
This commit is contained in:
parent
a6bbe0e50a
commit
dc4c34263d
@ -366,13 +366,13 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
|
|||||||
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
|
bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
|
||||||
std::size_t indent) {
|
std::size_t indent) {
|
||||||
out << "|\n";
|
out << "|\n";
|
||||||
out << IndentTo(indent);
|
|
||||||
int codePoint;
|
int codePoint;
|
||||||
for (std::string::const_iterator i = str.begin();
|
for (std::string::const_iterator i = str.begin();
|
||||||
GetNextCodePointAndAdvance(codePoint, i, str.end());) {
|
GetNextCodePointAndAdvance(codePoint, i, str.end());) {
|
||||||
if (codePoint == '\n') {
|
if (codePoint == '\n') {
|
||||||
out << "\n" << IndentTo(indent);
|
out << "\n";
|
||||||
} else {
|
} else {
|
||||||
|
out<< IndentTo(indent);
|
||||||
WriteCodePoint(out, codePoint);
|
WriteCodePoint(out, codePoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user