From df7a6fc8593ded1b5f9f860f9de90ad764525501 Mon Sep 17 00:00:00 2001 From: Ahmad Karlam Date: Wed, 12 May 2021 18:58:20 -0700 Subject: [PATCH] docs: add comment --- widgets/table.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/widgets/table.go b/widgets/table.go index ea88d0b..9fbf7c9 100644 --- a/widgets/table.go +++ b/widgets/table.go @@ -146,6 +146,7 @@ func (self *Table) Draw(buf *Buffer) { } func (self *Table) transformForTextWrap(row []string, i, j, columnWidth int) []string { + // Split words by column width words := strings.Split(row[j], " ") newWords := []string{} nextWords := []string{} @@ -161,6 +162,8 @@ func (self *Table) transformForTextWrap(row []string, i, j, columnWidth int) []s totalChar += len(word) + 1 } row[j] = strings.Join(newWords, " ") + + // Insert new sentence last := len(self.Rows) - 1 self.Rows = append(self.Rows, self.Rows[last]) copy(self.Rows[i+1:], self.Rows[i:last])