Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
a4b8521e
Commit
a4b8521e
authored
Sep 07, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed newlines in folded scalars bug
parent
70375629
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
src/scanscalar.cpp
+19
-3
No files found.
src/scanscalar.cpp
View file @
a4b8521e
...
...
@@ -21,6 +21,8 @@ namespace YAML
{
bool
foundNonEmptyLine
=
false
,
pastOpeningBreak
=
false
;
bool
emptyLine
=
false
,
moreIndented
=
false
;
int
foldedNewlineCount
=
0
;
bool
foldedNewlineStartedMoreIndented
=
false
;
std
::
string
scalar
;
params
.
leadingSpaces
=
false
;
...
...
@@ -109,13 +111,27 @@ namespace YAML
// was this an empty line?
bool
nextEmptyLine
=
Exp
::
Break
.
Matches
(
INPUT
);
bool
nextMoreIndented
=
(
INPUT
.
peek
()
==
' '
);
if
(
params
.
fold
&&
foldedNewlineCount
==
0
&&
nextEmptyLine
)
foldedNewlineStartedMoreIndented
=
moreIndented
;
// for block scalars, we always start with a newline, so we should ignore it (not fold or keep)
if
(
pastOpeningBreak
)
{
if
(
params
.
fold
&&
!
emptyLine
&&
!
nextEmptyLine
&&
!
moreIndented
&&
!
nextMoreIndented
&&
INPUT
.
column
()
>=
params
.
indent
)
scalar
+=
" "
;
else
if
(
params
.
fold
)
{
if
(
!
emptyLine
&&
!
nextEmptyLine
&&
!
moreIndented
&&
!
nextMoreIndented
&&
INPUT
.
column
()
>=
params
.
indent
)
scalar
+=
" "
;
else
if
(
nextEmptyLine
)
foldedNewlineCount
++
;
else
scalar
+=
"
\n
"
;
if
(
!
nextEmptyLine
&&
foldedNewlineCount
>
0
)
{
if
(
foldedNewlineStartedMoreIndented
||
nextMoreIndented
)
scalar
+=
std
::
string
(
"
\n
"
,
foldedNewlineCount
);
foldedNewlineCount
=
0
;
}
}
else
{
scalar
+=
"
\n
"
;
}
}
emptyLine
=
nextEmptyLine
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment