Skip to content

Preserve trailing newline in block chomping keep indicator (+) - #1504

Open
Tyagiquamar wants to merge 1 commit into
jbeder:masterfrom
Tyagiquamar:fix-block-chomping-newline-1502
Open

Tyagiquamar wants to merge 1 commit into
jbeder:masterfrom
Tyagiquamar:fix-block-chomping-newline-1502

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Problem

When emitting block scalars with keep chomping indicator (|+), yaml-cpp was deducting 1 from the emitted size for multiline scalars, dropping the trailing newline from the emitted output (#1502).

Solution

  • Updated src/emitterutils.cpp to emit the full scalar length for |+ (Keep chomping) without stripping the trailing newline.
  • Extended LiteralWithAndWithoutTrailingEmptyLines in test/integration/emitter_test.cpp to verify exact trailing newline preservation with block chomping keep indicator.

Validation

  • Built and verified test suite in Linux container with GCC 14:
    • 100% of yaml-cpp unit tests pass.

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
@SGSSGene SGSSGene added the AI label Oct 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants