Skip to content

A grid/table fails if a column width autosizes to zero. #361

@wischi-chr

Description

@wischi-chr

Information

  • Version: most recent master efa3d3b

Describe the bug
If a grid is created (I guess it's the same for tables, because a grid internally creates a table) and in one of the columns all rows have the content string.Empty the entire grid collapses to a single ellipsis .

To Reproduce

// Works as expected:
AnsiConsole.Console.Write(
    new Grid()
        .AddColumns(2)
        .AddRow("A", "B")
        .AddRow("X", "Y")
);
// Produces:
// A  B
// X  Y

// This fails:
AnsiConsole.Console.Write(
    new Grid()
        .AddColumns(2)
        .AddRow(string.Empty, "B")
        .AddRow(string.Empty, "Y")
);
// Produces:
// …

Expected behavior
The expected behaviour would be to measure the column, determine that it's zero width and not render it, but still render the second column like so:

// Result:
// B
// Y

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions