fix issue752: generate right long keys (#879)

* fix issue752: generate right long keys

* Improve the readability of test cases

* update to raw string literal
This commit is contained in:
Chen
2020-06-17 13:57:28 +08:00
committed by GitHub
parent a7a7908dc5
commit 72fe73a104
2 changed files with 52 additions and 0 deletions

View File

@@ -556,6 +556,8 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
break;
case EmitterNodeType::BlockSeq:
case EmitterNodeType::BlockMap:
if (m_pState->HasBegunContent())
m_stream << "\n";
break;
}
}
@@ -579,8 +581,12 @@ void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
case EmitterNodeType::Scalar:
case EmitterNodeType::FlowSeq:
case EmitterNodeType::FlowMap:
SpaceOrIndentTo(true, curIndent + 1);
break;
case EmitterNodeType::BlockSeq:
case EmitterNodeType::BlockMap:
if (m_pState->HasBegunContent())
m_stream << "\n";
SpaceOrIndentTo(true, curIndent + 1);
break;
}