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 #2002. Added feature to fill the remaining width with spaces. #2003

Merged
merged 6 commits into from
Sep 15, 2022

Conversation

BDisp
Copy link
Collaborator

@BDisp BDisp commented Sep 10, 2022

Fixes #2002 - By default the TextFormatter.Draw method should fill the remaining view width spaces. This way any view can fill all the view width. If it's false only the text width will be draw.

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

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.

I do not understand why this feature is needed.

The issue (#2002) does not describe the circumstances where the issue exists.

Can you please elaborate?

Terminal.Gui/Core/TextFormatter.cs Outdated Show resolved Hide resolved
@BDisp
Copy link
Collaborator Author

BDisp commented Sep 15, 2022

I do not understand why this feature is needed.

The issue (#2002) does not describe the circumstances where the issue exists.

Can you please elaborate?

In the unit test already explain why this change is needed. If the view width is bigger than the text length and we needed to fill the remaining with spaces. This allows any view to leverage all the text alignment feature.
Another advantage of this fill option is that isn't needed to clear the area before write. The View.Redraw currently use two methods to write to the screen, Clear and Draw. Using only the Draw method is possible to clear what is to be cleared and write what have to be write, increasing the performance.

@tig tig merged commit 28718e9 into gui-cs:develop Sep 15, 2022
@BDisp BDisp deleted the textformatter-draw-remaining-fix branch September 15, 2022 13:48
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.

TextFormatter only draw the text width without fill the remaining bounds width with spaces.
2 participants