-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table format error on windows after a automerge column #337
Comments
Can you please leave sample code to reproduce this issue? |
hi @jedib0t try this sample code. Compile the code to windows/amd64, then run the binary inside a windows command:
|
Try this workaround: Lines 78 to 93 in 730bce7
You will have to invoke |
hi @jedib0t On my windows, it still exists without any asian characters. And it is not fixed after calling Any other information you need to debug the issue? |
Can you share the raw output of the following and a screenshot of the same: package main
import (
"fmt"
"strings"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
)
func main() {
firstHeader := []interface{}{"c1", "c2", "c2", "c3"}
secondHeader := []interface{}{"c1", "c21", "c22", "c3"}
row1 := []interface{}{"foo", "bar", "baz", "qux"}
colConfigs := []table.ColumnConfig{
{Name: "c1", AutoMerge: true, AlignHeader: text.AlignCenter, Align: text.AlignCenter},
{Name: "c3", AutoMerge: true, AlignHeader: text.AlignCenter, Align: text.AlignCenter, VAlignHeader: text.VAlignMiddle},
}
t := table.NewWriter()
t.AppendHeader(firstHeader, table.RowConfig{AutoMerge: true})
t.AppendHeader(secondHeader)
t.AppendRow(row1)
t.SetColumnConfigs(colConfigs)
t.SetStyle(table.StyleLight)
t.Style().Options.SeparateRows = true
t.Style().Options.SeparateColumns = true
out := t.Render()
fmt.Println(out)
for _, line := range strings.Split(out, "\n") {
for _, char := range line {
fmt.Printf(text.FgWhite.Sprintf("%4d ", char))
}
fmt.Println()
}
for _, line := range strings.Split(out, "\n") {
for _, char := range line {
fmt.Printf(text.FgHiBlue.Sprintf("%4c ", char))
}
fmt.Println()
}
for _, line := range strings.Split(out, "\n") {
for _, char := range line {
width := text.RuneWidth(char)
color := text.FgGreen
if width > 1 {
color = text.FgRed
}
fmt.Printf(color.Sprintf("%4d ", width))
}
fmt.Println()
}
} |
@jedib0t sure, this is my output: |
|
Was able to reproduce the issue with |
Thanks, look forward to your fix |
Hey @sceneryback I've pushed a fix to the branch |
hi @jedib0t thank you very much! it seems fixed, look forward to seeing this in main branch as soon as possible I don't have a macbook by hand, if more tests passed, happy to see this fix merged :) |
raw output is:
|
Hey. The vertical breaks have nothing to do with this library. It is most probably your terminal and font than anything else. The asian characters are most probably taller than all the other characters on that line, and is causing your terminal to display those gaps between the box drawing characters. |
New release with the fix: https://github.com/jedib0t/go-pretty/releases/tag/v6.6.1 |
Describe the bug
columns after a automerge column overflows when rendering table only on windows
To Reproduce
render table with auto merge columns
Expected behavior
should not overflow, like that on macos:
Screenshots
Software (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: