From e5ac96d7bca1138d6d8e159c0d1da08a60232f32 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Wed, 13 Nov 2024 12:59:11 +0900 Subject: [PATCH] fix removeFromRightSpace process at scanner --- parser/parser_test.go | 5 +++++ scanner/scanner.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/parser/parser_test.go b/parser/parser_test.go index f9218b75..6bb85683 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -128,6 +128,11 @@ a: !tag a: !tag b: c d: e +`, + ` +a: + b: c + `, } for _, src := range sources { diff --git a/scanner/scanner.go b/scanner/scanner.go index 50e24b1a..9bd43aca 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -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 {