From 561416857aad21932a38d7f0729a07c50d9f067c Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 1 Sep 2023 17:22:24 +0200 Subject: [PATCH] Removed right padding from tables --- table/table.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/table/table.go b/table/table.go index ee94dec2dcd..7de2d46343a 100644 --- a/table/table.go +++ b/table/table.go @@ -18,6 +18,7 @@ package table import ( "fmt" "math" + "strings" ) // ColumnWidthMode is used to configure columns type @@ -127,6 +128,7 @@ func (t *Table) Render() string { res := "" for _, row := range t.rows { + line := "" for x, cell := range row.cells { selectedWidth := widths[x] if x < len(t.columnsWidthMode) { @@ -143,9 +145,10 @@ func (t *Table) Render() string { if x > 0 { line += " " } - res += cell.Pad(selectedWidth) + line += cell.Pad(selectedWidth) } - res += "\n" + + res += strings.TrimRight(line, " ") + "\n" } return res }