Skip to content

Fixes #3951. Adds View dependency to DimFunc and PosFunc #4210

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

Open
wants to merge 11 commits into
base: v2_develop
Choose a base branch
from

Conversation

BDisp
Copy link
Collaborator

@BDisp BDisp commented Jul 25, 2025

Fixes

Proposed Changes/Todos

  • Added DimFuncWithView with View dependency

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

@BDisp BDisp requested a review from tig as a code owner July 25, 2025 02:10
@BDisp BDisp requested review from tznind and removed request for tig July 25, 2025 02:15
@BDisp
Copy link
Collaborator Author

BDisp commented Jul 25, 2025

View.EndInit only should call View.SetNeedsLayout and the Application.Begin should call LayoutAndDraw and PositionCursor. This avoid layout event run more than once and there is no need to Begin call Invoke because in the RunIteration the LayoutAndDraw and PositionCursor only run after the first Iteration event is raised.

Copy link
Collaborator

@tig tig left a comment

Choose a reason for hiding this comment

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

This is slick. Nice work.

I think it would be better if, instead of creating a new class for DimFuncWIthView, you instead added an optional View property to DimFunc and added another constuctor that took a View. Or made the existing DimFunc constructor take an optional View parameter.

@BDisp
Copy link
Collaborator Author

BDisp commented Jul 25, 2025

Done. I opted for add the optional View parameter and property because is impossible to store in a property two different types Func<int> and Func<View, int>. I was forgetting to also add this feature in the PosFunc. All done, I hope it's enough.

@tig tig changed the title Fixes #3951. Add DimFuncWithView with a View dependency Fixes #3951. Add View dependency to DimFunc and DimPos Jul 25, 2025
@tig tig changed the title Fixes #3951. Add View dependency to DimFunc and DimPos Fixes #3951. Adds View dependency to DimFunc and DimPos Jul 25, 2025
@BDisp BDisp changed the title Fixes #3951. Adds View dependency to DimFunc and DimPos Fixes #3951. Adds View dependency to DimFunc and PosFunc Jul 26, 2025
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.

NeedsLayout should automatically know when there's a View dependency (e.g. Dim.Func())
2 participants