Skip to content

Commit

Permalink
fix(table): SuppressTrailingSpaces also removed spaces from the start
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <[email protected]>
  • Loading branch information
ilya-lesikov committed Jan 25, 2024
1 parent 79388bd commit 7170e18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"strings"
"unicode"

"github.com/jedib0t/go-pretty/v6/text"
)
Expand Down Expand Up @@ -691,7 +692,11 @@ func (t *Table) render(out *strings.Builder) string {
var trimmed []string
sc := bufio.NewScanner(strings.NewReader(outStr))
for sc.Scan() {
trimmed = append(trimmed, strings.TrimSpace(sc.Text()))
trimmed = append(trimmed, strings.TrimRightFunc(
sc.Text(), func(r rune) bool {
return unicode.IsSpace(r)
},
))
}
outStr = strings.Join(trimmed, "\n")
}
Expand Down

0 comments on commit 7170e18

Please sign in to comment.