]> Sergey Matveev's repositories - sgblog.git/commitdiff
Fix tabs issues in comments v0.6.1
authorSergey Matveev <stargrave@stargrave.org>
Sat, 23 May 2020 09:40:39 +0000 (12:40 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 23 May 2020 09:49:50 +0000 (12:49 +0300)
cmd/sgblog-comment-add/main.go
common.go

index 840c3782d0a9a5f3acce3c58cc5f0242d7cff6cb..719431b37318c1576402c7528531e14b50d7fbdf 100644 (file)
@@ -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]
index ca7d04ff454a5944f575eb17d2c70be5341eb44d..4e74ca0ac5e1c84df0db4d67df9e3afaa673c466 100644 (file)
--- 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"
 )