From ead28d0e8f97808d00eb102ab0552c1e85d39c27 Mon Sep 17 00:00:00 2001 From: Jeff Horwitz Date: Sun, 12 Feb 2023 10:32:42 -0500 Subject: [PATCH] increment lastColumn when inserting columns --- table.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/table.go b/table.go index 07c910a..0e5c047 100644 --- a/table.go +++ b/table.go @@ -346,6 +346,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 @@ -353,6 +354,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++ } }