You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using AutoMerge and WidthMax together on a ColumnConfig, unnecessary whitespace is left in rows where the column value is wrapped and has been merged.
To Reproduce
import (
"fmt""testing""github.com/jedib0t/go-pretty/v6/table""github.com/jedib0t/go-pretty/v6/text"
)
funcTestWrapWithVerticalMerge(t*testing.T) {
tbl:=table.NewWriter()
tbl.SetColumnConfigs([]table.ColumnConfig{
{
Name: "C1",
AutoMerge: true,
WidthMax: 10,
WidthMaxEnforcer: text.WrapSoft,
},
{
Name: "C2",
},
})
tbl.AppendHeader(table.Row{
"C1",
"C2",
})
tbl.AppendRows([]table.Row{
{
"very long row value that wraps",
"x",
},
{
"very long row value that wraps",
"y",
},
})
tblstring:=tbl.Render()
fmt.Println(tblstring)
}
Output:
=== RUN TestWrapWithVerticalMerge
+------------+----+
| C1 | C2 |
+------------+----+
| very long | x |
| row value | |
| that wraps | |
| | y |
| | |
| | |
+------------+----+
Expected behavior
I would expect the output to look more like the following, though I'm open to changes on the specifics. The main point is that, similar to #226, unnecessary space is left because it seems like the merging thinks the original row value (pre merge) is still present.
+------------+----+
| C1 | C2 |
+------------+----+
| very long | x |
| row value | y |
| that wraps | |
+------------+----+
Software (please complete the following information):
My go.mod has:
go 1.16
require (
github.com/jedib0t/go-pretty/v6 v6.4.6
)
OS: Linux
GoLang Version: go version go1.20.1 linux/amd64
The text was updated successfully, but these errors were encountered:
This would really do wonders for visual clarity on a set of tables I've been working on. Curious whether this is something that should be fairly doable or if it's going to involve big changes to the layout engine. If the former, I might be able to take a look into implementing it.
Describe the bug
When using
AutoMerge
andWidthMax
together on aColumnConfig
, unnecessary whitespace is left in rows where the column value is wrapped and has been merged.To Reproduce
Output:
Expected behavior
I would expect the output to look more like the following, though I'm open to changes on the specifics. The main point is that, similar to #226, unnecessary space is left because it seems like the merging thinks the original row value (pre merge) is still present.
Software (please complete the following information):
My
go.mod
has:go version go1.20.1 linux/amd64
The text was updated successfully, but these errors were encountered: