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

fix(block and several others): deprecate title struct, it's position, and related functions #1061

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

TadoTheMiner
Copy link
Contributor

I've deprecated Title, the title() function, Position, and the titles_position() function, and adapted the docs to have title_top() and title_bottom() in examples. While it was suggested to add top_title() and bottom_title(), and deprecate the old ones, there's no need because title_top() and title_bottom() have the same signatures, as the new functions would. It was also suggested that we add the top_titles and bottom_titles fields, this is currently not possible since the title() function supports having titles with no position. So we should rather add the fields after removing the deprecations. I was forced to add #![cfg_attr(test, allow(deprecated)] to lib.rs due to a rust bug. And you can ignore flake.nix and flake.lock, it's for Nix users, as I've switched to NixOS recently.

Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.2%. Comparing base (9bd89c2) to head (942ea3f).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1061     +/-   ##
=======================================
- Coverage   94.3%   94.2%   -0.1%     
=======================================
  Files         61      61             
  Lines      14768   14770      +2     
=======================================
- Hits       13932   13922     -10     
- Misses       836     848     +12     

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

@joshka joshka added this to the v0.27.0 milestone May 12, 2024
@TadoTheMiner
Copy link
Contributor Author

I've added TitlePosition enum and title_at_position function in block.rs (which calls title_top and title_bottom). The reason why I did so, is because a person using this function

fn foo(position: Position) -> Block {
    Block::new().title(Title::from("bar").position(position))
}

would have to write their own enum since Position is deprecated.
Position is now pub use ratatui::widgets::block::TitlePosition and no longer an enum.

@TadoTheMiner
Copy link
Contributor Author

Forgot mention issue #738

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