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(borders): Add FULL and EMPTY border sets #1182

Merged
merged 2 commits into from
Jun 18, 2024
Merged

feat(borders): Add FULL and EMPTY border sets #1182

merged 2 commits into from
Jun 18, 2024

Conversation

joshka
Copy link
Member

@joshka joshka commented Jun 16, 2024

border::FULL uses a full block symbol, while border::EMPTY uses an
empty space. This is useful for when you need to allocate space for the
border and apply the border style to a block without actually drawing a
border. This makes it possible to style the entire title area or a block
rather than just the title content.

use ratatui::{symbols::border, widgets::Block};
let block = Block::bordered().title("Title").border_set(border::FULL);
let block = Block::bordered().title("Title").border_set(border::EMPTY);

@joshka
Copy link
Member Author

joshka commented Jun 16, 2024

This was required in order to properly handle titles in the list example. Extracted from #1159

src/symbols.rs Outdated Show resolved Hide resolved
src/symbols.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.3%. Comparing base (cd64367) to head (b3353c3).

Current head b3353c3 differs from pull request most recent head 67ac29d

Please upload reports for the commit 67ac29d to get more accurate results.

Additional details and impacted files
@@          Coverage Diff           @@
##            main   #1182    +/-   ##
======================================
  Coverage   94.3%   94.3%            
======================================
  Files         61      61            
  Lines      14750   14860   +110     
======================================
+ Hits       13914   14024   +110     
  Misses       836     836            

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

`border::FULL` uses a full block symbol, while `border::EMPTY` uses an
empty space. This is useful for when you need to allocate space for the
border and apply the border style to a block without actually drawing a
border. This makes it possible to style the entire title area or a block
rather than just the title content.

```rust
use ratatui::{symbols::border, widgets::Block};
let block = Block::bordered().title("Title").border_set(border::FULL);
let block = Block::bordered().title("Title").border_set(border::EMPTY);
```
@joshka joshka merged commit 1365620 into main Jun 18, 2024
31 checks passed
@joshka joshka deleted the jm/more-borders branch June 18, 2024 00:59
itsjunetime pushed a commit to itsjunetime/ratatui that referenced this pull request Jun 23, 2024
`border::FULL` uses a full block symbol, while `border::EMPTY` uses an
empty space. This is useful for when you need to allocate space for the
border and apply the border style to a block without actually drawing a
border. This makes it possible to style the entire title area or a block
rather than just the title content.

```rust
use ratatui::{symbols::border, widgets::Block};
let block = Block::bordered().title("Title").border_set(border::FULL);
let block = Block::bordered().title("Title").border_set(border::EMPTY);
```
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.

4 participants