Fixed last newline of folded scalar bug

This commit is contained in:
Jesse Beder
2009-09-07 06:54:38 +00:00
parent e9d760eea9
commit 2aab5acab4
3 changed files with 6 additions and 10 deletions

View File

@@ -111,13 +111,8 @@ namespace YAML
bool nextMoreIndented = (INPUT.peek() == ' ');
// for block scalars, we always start with a newline, so we should ignore it (not fold or keep)
bool useNewLine = pastOpeningBreak;
// and for folded scalars, we don't fold the very last newline to a space
if(params.fold && !emptyLine && INPUT.column() < params.indent)
useNewLine = false;
if(useNewLine) {
if(params.fold && !emptyLine && !nextEmptyLine && !moreIndented && !nextMoreIndented)
if(pastOpeningBreak) {
if(params.fold && !emptyLine && !nextEmptyLine && !moreIndented && !nextMoreIndented && INPUT.column() >= params.indent)
scalar += " ";
else
scalar += "\n";

View File

@@ -368,6 +368,7 @@ namespace YAML
params.fold = (indicator == Keys::FoldedScalar);
// eat chomping/indentation indicators
params.chomp = CLIP;
int n = Exp::Chomp.Match(INPUT);
for(int i=0;i<n;i++) {
char ch = INPUT.get();