Commit 2aefb8d9 authored by Robert Griesemer's avatar Robert Griesemer

Fix bug in godoc tab conversion filter:

tabs after an empty line where not converted.

Also, made it more robust in the presence of
(unexpected) ' ' and '\v' chars in indentation
mode.

R=r
CC=golang-dev
https://golang.org/cl/181085
parent f0fcb2d5
......@@ -471,8 +471,8 @@ type tconv struct {
}
func (p *tconv) writeIndent(n int) (err os.Error) {
i := n * *tabwidth
func (p *tconv) writeIndent() (err os.Error) {
i := p.indent
for i > len(spaces) {
i -= len(spaces)
if _, err = p.output.Write(spaces); err != nil {
......@@ -490,12 +490,20 @@ func (p *tconv) Write(data []byte) (n int, err os.Error) {
for n, b = range data {
switch p.state {
case indenting:
if b == '\t' {
switch b {
case '\t', '\v':
p.indent += *tabwidth
case '\n':
p.indent = 0
if _, err = p.output.Write(data[n : n+1]); err != nil {
return
}
case ' ':
p.indent++
} else {
default:
p.state = collecting
pos = n
if err = p.writeIndent(p.indent); err != nil {
if err = p.writeIndent(); err != nil {
return
}
}
......
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