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: add Block::title_top and Block::title_top_bottom #940

Merged
merged 1 commit into from Feb 9, 2024

Commits on Feb 9, 2024

  1. feat: add Block::title_top and Block::title_top_bottom

    This adds the ability to add titles to the top and bottom of a block
    without having to use the `Title` struct (which will be removed in a
    future release - likely v0.28.0).
    
    Fixes a subtle bug if the title was created from a right aligned Line
    and was also right aligned. The title would be rendered one cell too far
    to the right.
    
    ```rust
    Block::bordered()
        .title_top(Line::raw("A").left_aligned())
        .title_top(Line::raw("B").centered())
        .title_top(Line::raw("C").right_aligned())
        .title_bottom(Line::raw("D").left_aligned())
        .title_bottom(Line::raw("E").centered())
        .title_bottom(Line::raw("F").right_aligned())
        .render(buffer.area, &mut buffer);
    // renders
    "┌A─────B─────C┐",
    "│             │",
    "└D─────E─────F┘",
    ```
    
    Addresses part of #738
    joshka committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    a0bd2b2 View commit details
    Browse the repository at this point in the history