rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tview.Table shown incorrectly in tview.Grid

darylhjd opened this issue · comments

It seems that the table being shown even though the condition has not been met.

Problem occurs after upgrading to 33a1d27. Previous commits work as expected.

Here is code that sets the condition for the table:

grid.AddItem(table, 5, 0, 10, 15, 0, 0, true).
	AddItem(table, 0, 5, 15, 10, 0, 80, true)

https://github.com/darylhjd/mangadesk/blob/592a08c8914eb60f11618af0fd08bd94d4828850/app/ui/manga_page.go#L100

The "Chapters" table is being shown incorrectly in the large view port.

Expected:
Large view port:
image
Small view port:
image

Actual:
Large view port:
image

Small view port:
image

As can be seen, the table that is meant to be shown in the small view port only is also shown in the large view port.

commented

Thanks for reporting this. Indeed, that last change to Grid didn't check for duplicate items in the grid definition. The latest commit should fix this.

Thanks for the fix, but I tried it again and it seemed the issue persisted which caused me to find out that the order of adding items to the grid affected the result of the drawing.

I have opened another PR to address this #991

commented

There was still a small bug in the last commit. The latest commit fixes this.