From 6b06445c328365bd96018c22e4ac3d3991a3bd9f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 17 Sep 2026 13:23:51 +0200 Subject: [PATCH] Name a missing header for a file of only newlines, and drop the overstated comment on the walk's draw order --- path.go | 3 +-- table.go | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/path.go b/path.go index a8fb71c..683a4ab 100644 --- a/path.go +++ b/path.go @@ -223,8 +223,7 @@ func walkTable(t *table, tail []string, w pathWalk, descended bool) (node, error if err != nil { return nil, err } - // Resolved before any draw, so a path that fails moves no seeded stream. A - // selector further down pins this table by ancestry, so the walk draws only + // A selector further down pins this table by ancestry, so the walk draws only // where none follows; drawing first could pick a row the selector is not inside. if w.pins != nil { if err := readRow(w.pins, t, sel, (descended || len(tail) > 0) && !hasSelector(tail)); err != nil { diff --git a/table.go b/table.go index 82fd619..f6de4d7 100644 --- a/table.go +++ b/table.go @@ -150,10 +150,11 @@ func readTableOptions(m map[string]any) (tableOptionValues, error) { func (t *table) parseRows(data string) error { data = strings.TrimSuffix(strings.TrimPrefix(data, "\xEF\xBB\xBF"), "\n") header, rest, _ := strings.Cut(data, "\n") - if data == "" { + header = strings.TrimSuffix(header, "\r") + if header == "" { return fmt.Errorf("has no header line naming its columns") } - t.columns = strings.Split(strings.TrimSuffix(header, "\r"), "\t") + t.columns = strings.Split(header, "\t") t.col = make(map[string]int, len(t.columns)) t.fields = make(map[string]node, len(t.columns)) for i, name := range t.columns {