Skip to content

Commit

Permalink
Also fix wide char handling on inline comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed Jun 1, 2020
1 parent 2ff61e1 commit 913338d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ var nodeTests = []struct {
},
}, {

"# š\ntrue\n",
"# š\ntrue # š\n",
yaml.Node{
Kind: yaml.DocumentNode,
Line: 2,
Expand All @@ -778,6 +778,7 @@ var nodeTests = []struct {
Line: 2,
Column: 1,
HeadComment: "# š",
LineComment: "# š",
}},
},
}, {
Expand Down
11 changes: 5 additions & 6 deletions scannerc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2856,13 +2856,12 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t
return false
}
skip_line(parser)
} else {
if parser.mark.index >= seen {
if len(text) == 0 {
start_mark = parser.mark
}
text = append(text, parser.buffer[parser.buffer_pos])
} else if parser.mark.index >= seen {
if len(text) == 0 {
start_mark = parser.mark
}
text = read(parser, text)
} else {
skip(parser)
}
}
Expand Down

0 comments on commit 913338d

Please sign in to comment.