Commit 2374edc6 authored by Rob Pike's avatar Rob Pike

go/doc: print only one newline between paragraphs

Fixes #2595.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5544068
parent 4cfa9e3c
...@@ -353,12 +353,10 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) { ...@@ -353,12 +353,10 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) {
width: width, width: width,
indent: indent, indent: indent,
} }
for i, b := range blocks(text) { for _, b := range blocks(text) {
switch b.op { switch b.op {
case opPara: case opPara:
if i > 0 { // l.write will add leading newline if required
w.Write(nl)
}
for _, line := range b.lines { for _, line := range b.lines {
l.write(line) l.write(line)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment