tui-lipan 0.1.0

Opinionated, component-based TUI framework for Rust - declarative components, reconciliation, layout engine, focus, overlays, and rich widgets on top of ratatui.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::layout::measure::min_size_constrained;

use super::{Divider, Orientation};
pub fn measure_divider(divider: &Divider) -> (u16, u16) {
    if divider.orientation == Orientation::Horizontal
        && let Some(label) = divider.label.as_deref()
    {
        let (label_w, _) = min_size_constrained(label, None, Some(1));
        let padding = divider.label_padding.saturating_mul(2);
        return (label_w.saturating_add(padding).max(1), 1);
    }

    (1, 1)
}