]> Cypherpunks repositories - gostls13.git/commitdiff
go/doc: print only one newline between paragraphs
authorRob Pike <r@golang.org>
Sat, 14 Jan 2012 19:57:32 +0000 (11:57 -0800)
committerRob Pike <r@golang.org>
Sat, 14 Jan 2012 19:57:32 +0000 (11:57 -0800)
Fixes #2595.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5544068

src/pkg/go/doc/comment.go

index 14809fec917ed89ac2743b189f794721b70da429..060e37bff148d21b2c9c4ab313c4276ee3b80866 100644 (file)
@@ -353,12 +353,10 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) {
                width:  width,
                indent: indent,
        }
-       for i, b := range blocks(text) {
+       for _, b := range blocks(text) {
                switch b.op {
                case opPara:
-                       if i > 0 {
-                               w.Write(nl)
-                       }
+                       // l.write will add leading newline if required
                        for _, line := range b.lines {
                                l.write(line)
                        }