From cfe593c6615455c961f85a947b257f7c27553f6c Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 23 May 2020 12:40:39 +0300 Subject: [PATCH] Fix tabs issues in comments --- cmd/sgblog-comment-add/main.go | 7 +++++-- common.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/sgblog-comment-add/main.go b/cmd/sgblog-comment-add/main.go index 840c378..719431b 100644 --- a/cmd/sgblog-comment-add/main.go +++ b/cmd/sgblog-comment-add/main.go @@ -106,10 +106,13 @@ func main() { note = bytes.TrimRight(note, "\r\n") // Remove trailing whitespaces, because git-notes-add will remove - // them anyway, and we have to know exact bytes count + // them anyway, and we have to know exact bytes count. Also convert + // all tabs into spaces lines := strings.Split(string(body), "\n") for i, line := range lines { - lines[i] = strings.TrimRight(line, " \r") + line = strings.ReplaceAll(line, " ", " ") + line = strings.TrimRight(line, " \r") + lines[i] = line } for lines[len(lines)-1] == "" { lines = lines[:len(lines)-1] diff --git a/common.go b/common.go index ca7d04f..4e74ca0 100644 --- a/common.go +++ b/common.go @@ -2,6 +2,6 @@ package sgblog const ( - Version = "0.6.0" + Version = "0.6.1" WhenFmt = "2006-01-02 15:04:05Z07:00" ) -- 2.48.1