tview icon indicating copy to clipboard operation
tview copied to clipboard

Enabling the fullscreen option on SetRoot has no effect on root table primitive

Open ninjarogue opened this issue 3 years ago • 1 comments

create table:

table := tview.NewTable()

	for r, entry := range tuples {
		for c := 0; c < 2; c++ {
			val := entry.Path

			if c == 1 {
				val = entry.Size
			}

			table.SetCell(r, c,
				tview.NewTableCell(val).
					SetTextColor(tcell.ColorWhite).
					SetAlign(tview.AlignCenter)).
				SetSelectable(true, false)
		}
	}
	

The table does not take up the full width of the terminal:

	if err := app.SetRoot(table, true).Run(); err != nil {
		panic(err)
	}

Is there something that I am doing wrong or is this a bug?

ninjarogue avatar Jul 01 '22 07:07 ninjarogue

By default, a table cell will only be as wide as its content. If you want it to expand when there is more space available, you need to set the expansion parameter to a positive value.

rivo avatar Aug 11 '22 19:08 rivo