Skip to content

Grid fixed item size goes to bottom right #1010

Closed
@jvalkeal

Description

@jvalkeal

Using GridView with zero column/row sizes causes item to be placed into bottom-right when user would expect it to go top-left:

Something like when doing tests:

BoxView box1 = new BoxView();
BoxView sbox1 = spy(box1);
GridView grid = new GridView();

grid.setShowBorders(false);
grid.setRowSize(1);
grid.setColumnSize(1);
grid.setShowBorder(false);
grid.addItem(sbox1, 0, 0, 1, 1, 0, 0);

grid.setRect(0, 0, 10, 10);
grid.draw(screen10x10);

verify(sbox1).setRect(0, 0, 1, 1);

For example:

+---------+
|         |
|         |
|        X|
+---------+

When it should be:

+---------+
|X        |
|         |
|         |
+---------+

Logic came from golang tview grid component and it looks like it's "conceptually" broken there as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions