mirror of
https://github.com/gizak/termui.git
synced 2025-04-24 13:48:50 +08:00
Merge remote-tracking branch 'origin/text-wrap-table' into text-wrap-table
# Conflicts: # widgets/table.go
This commit is contained in:
commit
66e013dd83
@ -146,6 +146,7 @@ func (self *Table) Draw(buf *Buffer) {
|
||||
}
|
||||
|
||||
func (self *Table) textWrapTransformer(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) textWrapTransformer(row []string, i, j, columnWidth int) []st
|
||||
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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user