diff --git a/scanner/context.go b/scanner/context.go index f6c06e1..7c5517d 100644 --- a/scanner/context.go +++ b/scanner/context.go @@ -198,7 +198,7 @@ func (c *Context) addOriginBuf(r rune) { } } -func (c *Context) removeRightSpaceFromBuf() int { +func (c *Context) removeRightSpaceFromBuf() { trimmedBuf := c.obuf[:c.notSpaceOrgCharPos] buflen := len(trimmedBuf) diff := len(c.obuf) - buflen @@ -206,7 +206,6 @@ func (c *Context) removeRightSpaceFromBuf() int { c.obuf = c.obuf[:buflen] c.buf = c.bufferedSrc() } - return diff } func (c *Context) isDocument() bool { diff --git a/scanner/scanner.go b/scanner/scanner.go index 9bd43ac..f1d2774 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -623,14 +623,7 @@ func (s *Scanner) scanNewLine(ctx *Context, c rune) { // --- // a:[space][space] // b: c - removedNum := ctx.removeRightSpaceFromBuf() - if !s.isFirstCharAtLine && removedNum > 0 { - s.column -= removedNum - s.offset -= removedNum - if s.savedPos != nil { - s.savedPos.Column -= removedNum - } - } + ctx.removeRightSpaceFromBuf() // There is no problem that we ignore CR which followed by LF and normalize it to LF, because of following YAML1.2 spec. // > Line breaks inside scalar content must be normalized by the YAML processor. Each such line break must be parsed into a single line feed character.