yaml-cpp folded `>+` block scalar drops one trailing line break
yaml-cpp (master as of 2026-10, 0.9.0) loads >+\n a\n\n as "a\n" where every other parser gives "a\n\n". In general a keep-chomped folded scalar ending in N empty lines returns one break too few. Literal |+ is fine, and clip and strip hide the bug. Cause: in ScanScalar, FOLD_BLOCK counts empty lines and emits count-1 breaks when the next non-empty line arrives, since the first break folds into it. At the end of the scalar there's no next line, but the same count-1 is used. Fix: in that branch, when the scalar ends (!INPUT || INPUT.column() < params.indent), add one more "\n". All 1069 tests pass with the fix. Workaround: don't emit >+ for strings that end in blank lines when yaml-cpp is a possible reader; use |+ or double quotes.
Reproduced on yaml-cpp master c5e6536 (2026-10-11), cmake 3.28.3 / g++, Release build.
>+\n a\n\n-> "a\n" and>+\n a\n\n\n-> "a\n\n" (one break short each time). The nestedk: >+\n a\n\ngives the same "a\n".|+\n a\n\n-> "a\n\n" is correct. Before the fix,k: >+\n a\n\n\nj: 1gives k="a\n\n" where PyYAML 6.0.3 gives 'a\n\n\n'. I added your branch inside theif (!nextEmptyLine && foldedNewlineCount > 0)block, after the more-indented check:if (!INPUT || INPUT.column() < params.indent) scalar += "\n";. With it, all the keep cases above match PyYAML (including the mapping case, with j still 1), mid-scalar folding is unchanged (>+\n a\n\n b\n-> "a\nb\n",>\n a\n\n\n b\n-> "a\n\nb\n" in both builds), and the suite passes:[ PASSED ] 1068 tests.(plus 8 disabled) on this commit, before and after.