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

Fixes #3469, #3473, #3482 - Dim.Auto fixes and Pos/Dim refactor to support TGD #3480

Merged
merged 100 commits into from
May 23, 2024

Conversation

tig
Copy link
Collaborator

@tig tig commented May 13, 2024

Fixes

Proposed Changes/Todos

The problem was I had removed some code I thought was dead in LayoutSubViews that forced a double calc of pos/dim in order to make DimAuto work when subviews depended on the view's dims. That code was very much "prototype" and didnt belong there anyway. I now have a much more elegant soution baked into SetRelativeLayout where if the Dim is DimAuto, we calcuate the Dim first (with Pos == 0) and then the Pos (using the resulalant dim).

This all highlighted clumisness in having ContentSize be nullable. So I changed it to non-nullable and added a SetContentsSize() method. The API is still a bit awkward to use so I may refactor it again at some point.

  • Refactor AutoSizeTrue/False unit tests into new tests that make sense.

  • New issue: Dim.Auto min: defines min size of the Frame. This should be min size of Content.Size!

I'm pretty confident #3473 is now fixed here.

Instead of focusing on #3469 (which is partially fixed), I'm now going to use this PR to also address:

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig tig requested a review from tznind May 14, 2024 22:28
@tig tig changed the title Fixes #3469, #3473 -Dim.Auto gets confused when one of Height/Width is Absolute Fixes #3469, #3473, #3482 -Dim.Auto gets confused when one of Height/Width is Absolute May 14, 2024
@tig tig changed the title Fixes #3469, #3473, #3482 -Dim.Auto gets confused when one of Height/Width is Absolute Fixes #3469, #3473, #3482 - Dim.Auto fixes and Pos/Dim refactor to support TGD May 14, 2024
@tig
Copy link
Collaborator Author

tig commented May 17, 2024

And I keep wanting to suggest not spending too much time perfecting the xmldoc comments right now, in favor of holding that off til this stabilizes, to save work and make it less enticing to stick to something for sunk cost fallacy reasons, which we all are guilty of sometimes - especially when we get "GetItDoneItis." 😅

I don't think one can spend enough time on XML docs. Nothing drives clarity of thought more than writing clear, crisp, and complete English sentences.

So that's me both suggesting that but also not, if you'd rather do it now. 🤷‍♂️

We can turn that inspection up to error before release, too, to make sure we don't miss any, which is better than having them but them getting out of date as implementation drifts from what's written in them.

@tig
Copy link
Collaborator Author

tig commented May 17, 2024

@dodexahedron I believe I've addressed all your feedback with the exception of those where I've left the comment unresolved with a question I added.

Really good stuff, and I appreciate your diligence.

tig added a commit to tig/Terminal.Gui that referenced this pull request May 17, 2024
@dodexahedron
Copy link
Collaborator

And I keep wanting to suggest not spending too much time perfecting the xmldoc comments right now, in favor of holding that off til this stabilizes, to save work and make it less enticing to stick to something for sunk cost fallacy reasons, which we all are guilty of sometimes - especially when we get "GetItDoneItis." 😅

I don't think one can spend enough time on XML docs. Nothing drives clarity of thought more than writing clear, crisp, and complete English sentences.

So that's me both suggesting that but also not, if you'd rather do it now. 🤷‍♂️
We can turn that inspection up to error before release, too, to make sure we don't miss any, which is better than having them but them getting out of date as implementation drifts from what's written in them.

Man I swear I had responded to this, but I must have mis-clicked. I wrote it on another PC, though, so I'll look when I'm able to on that.

The gist was "Agreed - XmlDoc is good and not optional in the finished product, but changes are likely to result in lost/wasted effort."

If you don't mind, no biggie. Just trying to save you some work and time. :)

@dodexahedron
Copy link
Collaborator

Specifically for this PR, I mean. Not as a SOP.

@dodexahedron
Copy link
Collaborator

@dodexahedron I believe I've addressed all your feedback with the exception of those where I've left the comment unresolved with a question I added.

Really good stuff, and I appreciate your diligence.

Now that I've (I think) acked existing comments, I'm diving back in to pull and look at the current code. :)

My intent for this pass is, unless there are any biggies that should block the refactor til being fixed, to comment on small things but otherwise target a green light for this PR so we can work on things that are actual changes outside just the refactor (several of which we already let sneak in, but oh well).

@dodexahedron
Copy link
Collaborator

After I cram dinner down my neck, that is. 😆

@dodexahedron
Copy link
Collaborator

Not done yet. I fell asleep at some point, which was much needed (what a week, man).

And it's 3AM, so I'm headed back to bed. Should have stuff for ya tomorrow (today). Good work. 🙂

@dodexahedron
Copy link
Collaborator

😭 I lost a review I was working on. I was on my laptop, booted into Ubuntu, writing in Kate, just in case github or my browser acted up.1

Then the machine hard locked up for a hardware reason I now need to look up the light flash codes for in the repair manual and probably get Dell on-site to replace if necessary. 😤

At least there wasn't anything profound in it, so I can recreate it on another machine. I'll probably do that til I fall asleep, so half an hour or so tonight.

Footnotes

  1. Well, not lost per se because it'll be there when I get it working again, but it's not accessible to me right now without taking it apart, which I'm not about to do at half til midnight. 😑

@dodexahedron
Copy link
Collaborator

Ok maybe not so much tonight. After going through some of my github inbox it's already just about midnight, so I'll pick it up tomorrow. Was planning on Tuesday having dedicated time for TG anyway. 🙂

Copy link
Collaborator

@dodexahedron dodexahedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few, this time. After sleeping on it, I scaled it further back from what I had before my laptop exploded, because of scope creep.

After these tweaks, I'd say it's fine to merge.

Then we can get to other changes & enhancements.

Terminal.Gui/Text/TextFormatter.cs Outdated Show resolved Hide resolved
Terminal.Gui/View/Layout/DimAuto.cs Outdated Show resolved Hide resolved
Terminal.Gui/View/Layout/DimAutoStyle.cs Outdated Show resolved Hide resolved
Terminal.Gui/View/Layout/LayoutStyle.cs Show resolved Hide resolved
Terminal.Gui/View/Layout/PosView.cs Outdated Show resolved Hide resolved
Terminal.Gui/View/ViewContent.cs Outdated Show resolved Hide resolved
@dodexahedron
Copy link
Collaborator

I'll start filing new issues targeting this after it is merged.

@tig tig merged commit 1cfa2de into gui-cs:v2_develop May 23, 2024
1 check passed
@dodexahedron
Copy link
Collaborator

🥳

Once I finish migrating the Roslyn stuff, I'll get to that draft issue I started a couple days ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants