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

feat: impl Widget for &str and String #952

Merged
merged 6 commits into from Feb 14, 2024
Merged

Conversation

kdheepak
Copy link
Collaborator

Currently, f.render_widget("hello world".bold(), area) works but f.render_widget("hello world", area) doesn't. This PR changes that my implementing Widget for &str and String. This makes it easier to render strings with no styles as widgets.

Example usage:

terminal.draw(|f| f.render_widget("Hello World!", f.size()))?;

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (11b452d) 91.9% compared to head (d430470) 91.9%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #952   +/-   ##
=====================================
  Coverage   91.9%   91.9%           
=====================================
  Files         61      61           
  Lines      15703   15723   +20     
=====================================
+ Hits       14436   14456   +20     
  Misses      1267    1267           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kdheepak kdheepak marked this pull request as draft February 13, 2024 20:22
Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

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

Tests and docs needed.

@kdheepak kdheepak marked this pull request as ready for review February 14, 2024 03:29
Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

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

Need to add some sort of comment to the Widget trait or widget module for this.

src/widgets.rs Outdated Show resolved Hide resolved
src/widgets.rs Outdated Show resolved Hide resolved
Copy link
Sponsor Member

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM

@kdheepak kdheepak merged commit 12f67e8 into main Feb 14, 2024
32 of 33 checks passed
@kdheepak kdheepak deleted the kd/impl-widget-for-str branch February 14, 2024 11:26
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

3 participants