Skip to content

SetHeaderColSpans use with many headers bug #35

Description

@ofabricio

I don't know if I'm using SetHeaderColSpans correctly, but the layout is off:

Source (playground):

package main

import (
	"os"

	"github.com/aquasecurity/table"
)

func main() {
	t := table.New(os.Stdout)
	t.SetHeaderColSpans(0, 2)
	t.SetHeaderColSpans(1, 2)
	t.AddHeaders("Header 1")
	t.AddHeaders("Header 2")
	t.AddHeaders("Header 3", "Header 4")
	t.AddRow("Col 1", "Col 2")
	t.AddFooters("Footer 1", "Footer 2")
	t.Render()
}

Outputs:

┌─────────────────────┐
│      Header 1       │
├────────────────────────┤
│        Header 2        │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1    │ Col 2    │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘

Expected:

┌─────────────────────┐
│      Header 1       │
├─────────────────────┤
│      Header 2       │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1    │ Col 2    │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions