diff --git a/table/table.go b/table/table.go index a3a3d4e6..8ad93053 100644 --- a/table/table.go +++ b/table/table.go @@ -532,14 +532,9 @@ func (t *Table) constructRow(index int, isOverflow bool) string { for c := 0; c < t.data.Columns(); c++ { cellWidth := t.widths[c] - // TODO(fix): small cells should be using '…' instead of '...'. This is rendered wrong when - // then cellWidth is greater than 3 but the visible cell (ie. after styling) is smaller than 3. - cell := "..." - switch { - case !isOverflow: + cell := "…" + if !isOverflow { cell = t.data.At(index, c) - case cellWidth < 3: - cell = "…" } cells = append(cells, t.style(index+1, c). diff --git a/table/table_test.go b/table/table_test.go index 3f96a821..0138d238 100644 --- a/table/table_test.go +++ b/table/table_test.go @@ -1053,7 +1053,7 @@ func TestTableHeightShrink(t *testing.T) { │ Chinese │ Nǐn hǎo │ Nǐ hǎo │ │ French │ Bonjour │ Salut │ │ Japanese │ こんにちは │ やあ │ -│ ... │ ... │ ... │ +│ … │ … │ … │ └──────────┴──────────────┴───────────┘ `) @@ -1074,12 +1074,11 @@ func TestTableHeightMinimum(t *testing.T) { Row("4", "Russian", "Zdravstvuyte", "Privet"). Row("5", "Spanish", "Hola", "¿Qué tal?") - // TODO: the ID column should be using '…' instead of '...'. How to check cell width while accounting for padding? expected := strings.TrimSpace(` ┌────┬──────────┬──────────────┬───────────┐ │ ID │ LANGUAGE │ FORMAL │ INFORMAL │ ├────┼──────────┼──────────────┼───────────┤ -│ .. │ ... │ ... │ ... │ +│ … │ … │ … │ … │ └────┴──────────┴──────────────┴───────────┘ `) @@ -1110,7 +1109,8 @@ func TestTableHeightMinimumShowData(t *testing.T) { } func TestTableHeightWithOffset(t *testing.T) { - //This test exists to check for a bug / edge case when the table has an offset and the height is exact. + // This test exists to check for a bug/edge case when the table has an + // offset and the height is set. table := New(). Height(8).