gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.69k stars 690 forks source link

Pos/Dim Thoughts and Exploration for V2 (and/or beyond) #3108

Open dodexahedron opened 10 months ago

dodexahedron commented 10 months ago

What follows is all related to Pos and Dim, but are more like ideas and discussion prompts. None of these things are bugs, but rather are design details that I think are worth considering. Some are based on C# design guidelines, and some are more opinionated, based on my experience with TG and TGD from primarily the consumer side, but also the maintainer side.

Soooo let's begin with a whopper!

A structural thing, but from a more pragmatic view of current implementation, where benefits can be realized with surprisingly little actual work:  

And, as an even less impactful change/thought (which I've also tried out):

And then going beyond TG itself, into tools that consume it and generate code using it, such as TGD:

tig commented 10 months ago

I'm not smart enough yet to really grok all of this.

I'm also not confident in our Pos/Dim/SetRelativeLayout/LayoutSubviews unit test coverage.

Therefore, my vote is "Go for it! But before you do, we must significantly up our unit test game in this area."

Also, wait until I get Dim.Auto done so I'm not working on a moving target. https://github.com/gui-cs/Terminal.Gui/pull/3062

In my work on Dim.Auto so far I have found several places where I don't think anyone understood the codebase. I found several cases that were clearly broken, but nobody noticed (e.g. Pos.Center() + Pos.Absolute())). There's another dragon lurking that I have a bad feeling about having to do with Dim.Fill and Pos.Center...

dodexahedron commented 10 months ago

I'd be happy to work on some TDD for those types, once I'm finished with the work I'm doing with TerminalGuiDesigner's test project.

They're pretty critical core classes, so I wholeheartedly agree they should be tested excessively. :)

I imagine the work on the TerminalGuiDesigner test project will probably take me another week or two, if I'm able to keep up my current pace.

tig commented 6 months ago

See

It makes progress on cleaning up these classes.

tig commented 5 months ago

Now that #3480 is merged and #3415 is almost ready, it would be awesome if this Issue were updated with a clear list of the remaining issues you have related to all this.

dodexahedron commented 5 months ago

Yeah I actually think this one is basically obsolete, as some things have changed over time.

The fundamental thoughts are still more or less the same, but this was originally intended to be more of a discussion and brainstorming prompt than anything.

For actual work, smaller bite-sized pieces like the interface issue draft I started are more my intent for this. Although that one isn't exactly tiny either. But it's still not really terribly complex - especially if I whiteboard it out to better visualize stuff.

I may actually shift to that stuff for tomorrow, since EV validation for the new org code signing cert is going to take a bit of time and then the physical usb token/essentially smart card (FIPS 140-3...woooo... 🙄) is sent by FedEx ground from Ontario to Arizona once that's all done. So I won't be publishing refactored NuGet packages for a few more days, still, at least, while I'm waiting on that.