douglasg14b / BetterConsoleTables

Faster, colorable, more configurable, and more robust console colors & tables for C# console applications
GNU Lesser General Public License v3.0
92 stars 16 forks source link

Using value formatters of type string while all values in a row are strings leads to formating for that row being skipped #37

Open YuumiPie opened 5 months ago

YuumiPie commented 5 months ago

I'm not sure that this is similar for other types, but the example below gives an bugged output for the string case:

public Void Run()
{
Table table = new TableBuilder()
    .AddColumn("one")
    .AddColumn("two")
    .RowFormatter<string>(Format)
    .AddColumn("three")
    .RowFormatter<string>(Format)
    .AddColumn("four")
    .AddColumn("five")
    .Build();

table.Config = TableConfig.Unicode();
table.Config = TableConfig.Unicode();
table.AddRow("1", "2","3","4", 123);
table.AddRow("1", "2(\u2190test)","3(\u2190test)","test", 123);
table.AddRow("1", "2(test)","3(test)","test", "123");
table.AddRow("1", "2(test)","3(test)","test", "123");
table.AddRow("1", "2(\u2190test)","3(\u2190test)","test", "123");

Console.WriteLine(table.ToString());
}

private string Format(string test)
{
Color positive = Color.FromArgb(152, 168, 75);
return test.ForegroundColor(positive);
}

Output: image

Expected result is that all lines would have the two green columns. Breakpoints show that the whole method is skipped in the incorrect rows.