Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tig opened this issue May 11, 2024 · 3 comments
Assignees
Labels

Comments

@tig
Copy link
Collaborator

tig commented May 11, 2024

  • 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.

@tig tig added the bug label May 11, 2024
@tig tig self-assigned this May 11, 2024
@tig
Copy link
Collaborator Author

tig commented May 11, 2024

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...

tig added a commit to tig/Terminal.Gui that referenced this issue May 11, 2024
@tig
Copy link
Collaborator Author

tig commented May 11, 2024

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

@BDisp
Copy link
Collaborator

BDisp commented May 11, 2024

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.

tig added a commit that referenced this issue May 23, 2024
Fixes #3469, #3473, #3482  - `Dim.Auto` fixes and `Pos`/`Dim` refactor to support TGD
@tig tig closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: ✅ Done
Development

No branches or pull requests

2 participants