mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Fixed flow seq/map indentation
This commit is contained in:
@@ -339,7 +339,6 @@ namespace YAML
|
|||||||
|
|
||||||
void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child)
|
void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child)
|
||||||
{
|
{
|
||||||
const unsigned curIndent = m_pState->CurIndent();
|
|
||||||
const unsigned lastIndent = m_pState->LastIndent();
|
const unsigned lastIndent = m_pState->LastIndent();
|
||||||
|
|
||||||
if(!m_pState->HasBegunNode()) {
|
if(!m_pState->HasBegunNode()) {
|
||||||
@@ -359,7 +358,7 @@ namespace YAML
|
|||||||
case EmitterNodeType::Scalar:
|
case EmitterNodeType::Scalar:
|
||||||
case EmitterNodeType::FlowSeq:
|
case EmitterNodeType::FlowSeq:
|
||||||
case EmitterNodeType::FlowMap:
|
case EmitterNodeType::FlowMap:
|
||||||
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, curIndent);
|
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, lastIndent);
|
||||||
break;
|
break;
|
||||||
case EmitterNodeType::BlockSeq:
|
case EmitterNodeType::BlockSeq:
|
||||||
case EmitterNodeType::BlockMap:
|
case EmitterNodeType::BlockMap:
|
||||||
@@ -431,7 +430,6 @@ namespace YAML
|
|||||||
|
|
||||||
void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child)
|
void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child)
|
||||||
{
|
{
|
||||||
const unsigned curIndent = m_pState->CurIndent();
|
|
||||||
const unsigned lastIndent = m_pState->LastIndent();
|
const unsigned lastIndent = m_pState->LastIndent();
|
||||||
|
|
||||||
if(!m_pState->HasBegunNode()) {
|
if(!m_pState->HasBegunNode()) {
|
||||||
@@ -451,7 +449,7 @@ namespace YAML
|
|||||||
case EmitterNodeType::Scalar:
|
case EmitterNodeType::Scalar:
|
||||||
case EmitterNodeType::FlowSeq:
|
case EmitterNodeType::FlowSeq:
|
||||||
case EmitterNodeType::FlowMap:
|
case EmitterNodeType::FlowMap:
|
||||||
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, curIndent);
|
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, lastIndent);
|
||||||
break;
|
break;
|
||||||
case EmitterNodeType::BlockSeq:
|
case EmitterNodeType::BlockSeq:
|
||||||
case EmitterNodeType::BlockMap:
|
case EmitterNodeType::BlockMap:
|
||||||
@@ -462,7 +460,6 @@ namespace YAML
|
|||||||
|
|
||||||
void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child)
|
void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child)
|
||||||
{
|
{
|
||||||
const unsigned curIndent = m_pState->CurIndent();
|
|
||||||
const unsigned lastIndent = m_pState->LastIndent();
|
const unsigned lastIndent = m_pState->LastIndent();
|
||||||
|
|
||||||
if(!m_pState->HasBegunNode()) {
|
if(!m_pState->HasBegunNode()) {
|
||||||
@@ -479,7 +476,7 @@ namespace YAML
|
|||||||
case EmitterNodeType::Scalar:
|
case EmitterNodeType::Scalar:
|
||||||
case EmitterNodeType::FlowSeq:
|
case EmitterNodeType::FlowSeq:
|
||||||
case EmitterNodeType::FlowMap:
|
case EmitterNodeType::FlowMap:
|
||||||
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, curIndent);
|
SpaceOrIndentTo(m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0, lastIndent);
|
||||||
break;
|
break;
|
||||||
case EmitterNodeType::BlockSeq:
|
case EmitterNodeType::BlockSeq:
|
||||||
case EmitterNodeType::BlockMap:
|
case EmitterNodeType::BlockMap:
|
||||||
|
@@ -205,7 +205,7 @@ namespace Test
|
|||||||
out << YAML::Value << "angel";
|
out << YAML::Value << "angel";
|
||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
|
|
||||||
desiredOutput = "? - 1\n - 3\n: monster\n? [2, 0]\n: demon\nthe origin: angel";
|
desiredOutput = "? - 1\n - 3\n: monster\n[2, 0]: demon\nthe origin: angel";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScalarFormat(YAML::Emitter& out, std::string& desiredOutput)
|
void ScalarFormat(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
Reference in New Issue
Block a user