Removes some code that doesn't make much sense. Commented in case it needs to be added back later.

This commit is contained in:
sloum 2023-07-07 20:24:21 -07:00
parent 9d4b5a2763
commit 2d1bef7488
1 changed files with 10 additions and 7 deletions

17
main.go
View File

@ -494,13 +494,16 @@ func (ctx *textifyTraverseContext) emit(data string) error {
)
for _, line := range lines {
runes := []rune(line)
startsWithSpace := unicode.IsSpace(runes[0])
if !startsWithSpace && !ctx.endsWithSpace && !strings.HasPrefix(data, ".") {
if err = ctx.buf.WriteByte(' '); err != nil {
return err
}
ctx.lineLength++
}
// XXX I cannot figure out for the life of me why a single space indent
// was being added here. But it was really wonky... so let's ditch it?
//
// startsWithSpace := unicode.IsSpace(runes[0])
// if !startsWithSpace && !ctx.endsWithSpace && !strings.HasPrefix(data, ".") {
// if err = ctx.buf.WriteByte(' '); err != nil {
// return err
// }
// ctx.lineLength++
// }
ctx.endsWithSpace = unicode.IsSpace(runes[len(runes)-1])
for _, c := range line {
if _, err = ctx.buf.WriteString(string(c)); err != nil {