File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package table
18
18
import (
19
19
"fmt"
20
20
"math"
21
+ "strings"
21
22
)
22
23
23
24
// ColumnWidthMode is used to configure columns type
@@ -127,7 +128,7 @@ func (t *Table) Render() string {
127
128
128
129
res := ""
129
130
for _ , row := range t .rows {
130
- separator := ""
131
+ line := ""
131
132
for x , cell := range row .cells {
132
133
selectedWidth := widths [x ]
133
134
if x < len (t .columnsWidthMode ) {
@@ -141,11 +142,13 @@ func (t *Table) Render() string {
141
142
if selectedWidth < minimum [x ] {
142
143
selectedWidth = minimum [x ]
143
144
}
144
- res += separator
145
- res += cell .Pad (selectedWidth )
146
- separator = " "
145
+ if x > 0 {
146
+ line += " "
147
+ }
148
+ line += cell .Pad (selectedWidth )
147
149
}
148
- res += "\n "
150
+
151
+ res += strings .TrimRight (line , " " ) + "\n "
149
152
}
150
153
return res
151
154
}
You can’t perform that action at this time.
0 commit comments