From: Sergey Matveev Date: Sat, 23 May 2020 09:40:39 +0000 (+0300) Subject: Fix tabs issues in comments X-Git-Tag: v0.6.1^0 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=cfe593c6615455c961f85a947b257f7c27553f6c;p=sgblog.git Fix tabs issues in comments --- 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" )