Closed
Description
Hello! Thank you for your work on this useful package!
Describe the bug
When calculating the size of columns, merging table cells is not taken into account
To Reproduce
Go Playground.
package main
import (
"fmt"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
)
func main() {
tw := table.NewWriter()
tw.AppendHeader(table.Row{"ID", "Date", "From", "To", "Subject", "Size"})
tw.AppendRow(table.Row{
4,
"2024-11-18T09:30:54Z",
"Shaylee McDermott",
"",
"Tote bag photo booth lumbersexual normcore synth meh lumbersexual disrupt craft beer aesthetic.",
"4.2 MB",
})
tw.AppendRow(table.Row{
4,
"2024-11-18T09:30:54Z",
"Anahi Braun ",
"",
"Mumblecore salvia mumblecore austin tofu viral asymmetrical small batch distillery you probably haven't heard of them.",
"4.2 MB",
})
tw.AppendRow(table.Row{
4,
"2024-11-18T09:30:54Z",
"Brando Barton",
"",
"Before they sold out jean shorts chartreuse neutra fixie flexitarian goth art party small batch sriracha.",
"4.2 MB",
})
const ID = "AAMkADdiOWM1OTBkLTBhZjEtNGFiNS1hOGYwLTY2YWFmOGQyNTMxNgBGAAAAAADBju3TxrP2SZIsqjNb8hmoBwA9J0gY/4/nQ73Lmp9F9NoaAABlJ281AAA9J0gY/4/nQ73Lmp9F9NoaAABlJ6bLAAA="
tw.AppendRow(
table.Row{ID, ID, ID, ID, ID, ID},
table.RowConfig{
AutoMerge: true,
AutoMergeAlign: text.AlignLeft,
})
fmt.Println(tw.Render())
}
Expected behavior
+----+----------------------+-------------------+----+------------------------------------------------------------------------------------------------------------------------+--------+
| ID | DATE | FROM | TO | SUBJECT | SIZE |
+----+----------------------+-------------------+----+------------------------------------------------------------------------------------------------------------------------+--------+
| 4 | 2024-11-18T09:30:54Z | Shaylee McDermott | | Tote bag photo booth lumbersexual normcore synth meh lumbersexual disrupt craft beer aesthetic. | 4.2 MB |
| 4 | 2024-11-18T09:30:54Z | Anahi Braun | | Mumblecore salvia mumblecore austin tofu viral asymmetrical small batch distillery you probably haven't heard of them. | 4.2 MB |
| 4 | 2024-11-18T09:30:54Z | Brando Barton | | Before they sold out jean shorts chartreuse neutra fixie flexitarian goth art party small batch sriracha. | 4.2 MB |
| AAMkADdiOWM1OTBkLTBhZjEtNGFiNS1hOGYwLTY2YWFmOGQyNTMxNgBGAAAAAADBju3TxrP2SZIsqjNb8hmoBwA9J0gY/4/nQ73Lmp9F9NoaAABlJ281AAA9J0gY/4/nQ73Lmp9F9NoaAABlJ6bLAAA= |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Actual behavior
+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| ID | DATE | FROM | TO | SUBJECT | SIZE |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| 4 | 2024-11-18T09:30:54Z | Shaylee McDermott | | Tote bag photo booth lumbersexual normcore synth meh lumbersexual disrupt craft beer aesthetic. | 4.2 MB |
| 4 | 2024-11-18T09:30:54Z | Anahi Braun | | Mumblecore salvia mumblecore austin tofu viral asymmetrical small batch distillery you probably haven't heard of them. | 4.2 MB |
| 4 | 2024-11-18T09:30:54Z | Brando Barton | | Before they sold out jean shorts chartreuse neutra fixie flexitarian goth art party small batch sriracha. | 4.2 MB |
| AAMkADdiOWM1OTBkLTBhZjEtNGFiNS1hOGYwLTY2YWFmOGQyNTMxNgBGAAAAAADBju3TxrP2SZIsqjNb8hmoBwA9J0gY/4/nQ73Lmp9F9NoaAABlJ281AAA9J0gY/4/nQ73Lmp9F9NoaAABlJ6bLAAA= |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Software:
- GoLang Version 1.23