File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package table
1818import (
1919 "fmt"
2020 "math"
21+ "strings"
2122)
2223
2324// ColumnWidthMode is used to configure columns type
@@ -127,7 +128,7 @@ func (t *Table) Render() string {
127128
128129 res := ""
129130 for _ , row := range t .rows {
130- separator := ""
131+ line := ""
131132 for x , cell := range row .cells {
132133 selectedWidth := widths [x ]
133134 if x < len (t .columnsWidthMode ) {
@@ -141,11 +142,13 @@ func (t *Table) Render() string {
141142 if selectedWidth < minimum [x ] {
142143 selectedWidth = minimum [x ]
143144 }
144- res += separator
145- res += cell .Pad (selectedWidth )
146- separator = " "
145+ if x > 0 {
146+ line += " "
147+ }
148+ line += cell .Pad (selectedWidth )
147149 }
148- res += "\n "
150+
151+ res += strings .TrimRight (line , " " ) + "\n "
149152 }
150153 return res
151154}
You can’t perform that action at this time.
0 commit comments