mirror of
https://github.com/gizak/termui.git
synced 2025-04-27 13:48:51 +08:00
docs: add comment
This commit is contained in:
parent
76662a1ebd
commit
df7a6fc859
@ -146,6 +146,7 @@ func (self *Table) Draw(buf *Buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Table) transformForTextWrap(row []string, i, j, columnWidth int) []string {
|
func (self *Table) transformForTextWrap(row []string, i, j, columnWidth int) []string {
|
||||||
|
// Split words by column width
|
||||||
words := strings.Split(row[j], " ")
|
words := strings.Split(row[j], " ")
|
||||||
newWords := []string{}
|
newWords := []string{}
|
||||||
nextWords := []string{}
|
nextWords := []string{}
|
||||||
@ -161,6 +162,8 @@ func (self *Table) transformForTextWrap(row []string, i, j, columnWidth int) []s
|
|||||||
totalChar += len(word) + 1
|
totalChar += len(word) + 1
|
||||||
}
|
}
|
||||||
row[j] = strings.Join(newWords, " ")
|
row[j] = strings.Join(newWords, " ")
|
||||||
|
|
||||||
|
// Insert new sentence
|
||||||
last := len(self.Rows) - 1
|
last := len(self.Rows) - 1
|
||||||
self.Rows = append(self.Rows, self.Rows[last])
|
self.Rows = append(self.Rows, self.Rows[last])
|
||||||
copy(self.Rows[i+1:], self.Rows[i:last])
|
copy(self.Rows[i+1:], self.Rows[i:last])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user