eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
use ratatui::layout::{Constraint, Direction, Layout, Rect};

pub fn determine_layout(count: usize, screen_width: u16) -> (u16, u16, bool) {
    let use_two_column = count >= 10 && count < 30 && screen_width >= 120;
    
    let (width, height) = if count < 10 {
        (50, 35)  // Compact for small result sets
    } else if count < 30 {
        if use_two_column {
            (75, 45)  // Wider for two-column layout
        } else {
            (65, 45)  // Medium for medium result sets
        }
    } else {
        (75, 55)  // Larger for large result sets with categories
    };
    
    (width, height, use_two_column)
}

pub fn center_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
    let vertical = Layout::default()
        .direction(Direction::Vertical)
        .constraints([
            Constraint::Percentage((100 - percent_y) / 2),
            Constraint::Percentage(percent_y),
            Constraint::Percentage((100 - percent_y) / 2),
        ])
        .split(r);
    let horizontal = Layout::default()
        .direction(Direction::Horizontal)
        .constraints([
            Constraint::Percentage((100 - percent_x) / 2),
            Constraint::Percentage(percent_x),
            Constraint::Percentage((100 - percent_x) / 2),
        ])
        .split(vertical[1]);
    horizontal[1]
}