gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Dim.Auto (DimAutoStyle.Text)` confuses `TextFormatter` when `Width` is absoulte and `Height` is auto

tig opened this issue · comments

commented
  • Change CheckBox's constructor to set Height = Dim.Auto (DimAutoStyle.Text)
  • Checkbox unit tests fail when they shouldn't

image

This test sets Width to an absolute.

        var checkBox = new CheckBox
        {
            X = 1,
            Y = Pos.Center (),
            Text = "Check this out 你",
            TextAlignment = Alignment.Centered,
            Width = 25
        };

For some reason, this is confusing TextFormatter.

commented

The bug is here. I knew this was a hack. ;-)

image

The root of the issue is TextFormatter.AutoSize applies to both width & height. Like View, it needs to treat them independently.

There may be another workaround that doesn't require rewriting TextFormatter...

commented

I found this, and have a workaround in the PosAlign scenario in #3415

The root of the issue is TextFormatter.AutoSize applies to both width & height. Like View, it needs to treat them independently.

It only consider the text direction for the AutoSize.