-
Notifications
You must be signed in to change notification settings - Fork 700
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
Fixes #3366 - Add ability to disable AutoSize #3402
Conversation
Love. I'll look deeper later today. |
I have a better idea. Now that the exception I put in has weeded out all/most code that is incorrect, we can remove it and instead just change public Dim Width
{
get => VerifyIsInitialized (_width, nameof (Width));
set
{
if (Equals (_width, value))
{
return;
}
_width = value ?? throw new ArgumentNullException (nameof (value), @$"{nameof (Width)} cannot be null");
if (AutoSize)
{
Debug.WriteLine (@$"Must set AutoSize to false before setting {nameof (Width)}.");
AutoSize = false;
}
bool isValidNewAutoSize = AutoSize && IsValidAutoSizeWidth (_width);
if (IsAdded && AutoSize && !isValidNewAutoSize)
{
Debug.WriteLine (@$"Must set AutoSize to false before setting {nameof (Width)}.");
AutoSize = false;
}
OnResizeNeeded ();
}
} If I do this, all unit tests pass and I see no functional issues in some light tests... |
|
Ah I see how you mean. Replace the exception with |
@tig I have changed this PR to do as you suggest (Set AutoSize=false instead of throw Exception). Please let me know if I have misunderstood. |
Further work requires updating once gui-cs/Terminal.Gui#3402 is merged and published
Fixes
Proposed Changes/Todos
Adds a static variable that allows disableing AutoSize.Disables AutoSize instead of throwing Exception when setting Width/Height on a View
Currently the designer emits code as follows:
I looked into adding AutoSize = false on every single view generated and every piece of code emitted. That kinda worked but was ugly. Then I realized I had to update all my existing .Designer.cs files code with this
AutoSize=false
too.I think this is a better solution, the ability to disable autosize across the board.
This can be removed once AutoSize itself is removed.
Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)