Skip to content

Commit

Permalink
fix removeFromRightSpace process at scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Nov 13, 2024
1 parent cb4e1b0 commit e5ac96d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ a: !tag
a: !tag
b: c
d: e
`,
`
a:
b: c
`,
}
for _, src := range sources {
Expand Down
2 changes: 1 addition & 1 deletion scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func (s *Scanner) scanNewLine(ctx *Context, c rune) {
// a:[space][space]
// b: c
removedNum := ctx.removeRightSpaceFromBuf()
if removedNum > 0 {
if !s.isFirstCharAtLine && removedNum > 0 {
s.column -= removedNum
s.offset -= removedNum
if s.savedPos != nil {
Expand Down

0 comments on commit e5ac96d

Please sign in to comment.