mirror of
https://github.com/golang/go
synced 2024-11-22 01:54:42 -07:00
tabwriter: indicate section breaks if Debug flag is set
R=rsc CC=golang-dev https://golang.org/cl/224057
This commit is contained in:
parent
c426427b89
commit
e0d5177dd7
@ -281,6 +281,7 @@ func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int, err os.Error)
|
|||||||
c := line.At(j).(cell)
|
c := line.At(j).(cell)
|
||||||
|
|
||||||
if j > 0 && b.flags&Debug != 0 {
|
if j > 0 && b.flags&Debug != 0 {
|
||||||
|
// indicate column break
|
||||||
if err = b.write0(vbar); err != nil {
|
if err = b.write0(vbar); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -496,6 +497,8 @@ func (b *Writer) Flush() os.Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var hbar = []byte{'-', '-', '-', '\n'}
|
||||||
|
|
||||||
// Write writes buf to the writer b.
|
// Write writes buf to the writer b.
|
||||||
// The only errors returned are ones encountered
|
// The only errors returned are ones encountered
|
||||||
// while writing to the underlying output stream.
|
// 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 {
|
if err = b.Flush(); err != nil {
|
||||||
return
|
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",
|
"11\t222\t3333\t44444\n",
|
||||||
|
|
||||||
"1|2|3|4\n" +
|
"1|2|3|4\n" +
|
||||||
|
"---\n" +
|
||||||
"11|222|3333|44444\n",
|
"11|222|3333|44444\n",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user