Commit e0d5177d authored by Robert Griesemer's avatar Robert Griesemer

tabwriter: indicate section breaks if Debug flag is set

R=rsc
CC=golang-dev
https://golang.org/cl/224057
parent c426427b
......@@ -281,6 +281,7 @@ func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int, err os.Error)
c := line.At(j).(cell)
if j > 0 && b.flags&Debug != 0 {
// indicate column break
if err = b.write0(vbar); err != nil {
return
}
......@@ -496,6 +497,8 @@ func (b *Writer) Flush() os.Error {
}
var hbar = []byte{'-', '-', '-', '\n'}
// Write writes buf to the writer b.
// The only errors returned are ones encountered
// while writing to the underlying output stream.
......@@ -525,6 +528,12 @@ func (b *Writer) Write(buf []byte) (n int, err os.Error) {
if err = b.Flush(); err != nil {
return
}
if ch == '\f' && b.flags&Debug != 0 {
// indicate section break
if err = b.write0(hbar); err != nil {
return
}
}
}
}
......
......@@ -318,6 +318,7 @@ var tests = []entry{
"11\t222\t3333\t44444\n",
"1|2|3|4\n" +
"---\n" +
"11|222|3333|44444\n",
},
......
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