mirror of
https://github.com/rivo/tview.git
synced 2025-04-24 13:48:56 +08:00
Merge ead28d0e8f97808d00eb102ab0552c1e85d39c27 into c76f7879f592d17e9e68a1d795a85faae6cb7414
This commit is contained in:
commit
11bdf8b698
5
table.go
5
table.go
@ -379,6 +379,7 @@ func (t *tableDefaultContent) InsertRow(row int) {
|
||||
|
||||
// InsertColumn inserts a new column at the given position.
|
||||
func (t *tableDefaultContent) InsertColumn(column int) {
|
||||
var didInsert bool
|
||||
for row := range t.cells {
|
||||
if column >= len(t.cells[row]) {
|
||||
continue
|
||||
@ -386,6 +387,10 @@ func (t *tableDefaultContent) InsertColumn(column int) {
|
||||
t.cells[row] = append(t.cells[row], nil) // Extend by one.
|
||||
copy(t.cells[row][column+1:], t.cells[row][column:]) // Shift to the right.
|
||||
t.cells[row][column] = &TableCell{} // New element is an uninitialized table cell.
|
||||
didInsert = true
|
||||
}
|
||||
if didInsert {
|
||||
t.lastColumn++
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user