//! Common utilities for render benchmarks

use reovim_core::{
    buffer::{Buffer, TextOps},
    content::WindowContentSource,
    screen::{
        WindowId, WindowRect,
        window::{LineNumber, SignColumnMode, Viewport, Window, WindowConfig},
    },
};

/// Create a buffer with the specified number of lines
pub fn create_buffer(lines: usize) -> Buffer {
    let content = (0..lines)
        .map(|i| format!("Line {i} with some typical text content for benchmarking"))
        .collect::<Vec<_>>()
        .join("\n");
    let mut buf = Buffer::empty(0);
    buf.set_content(&content);
    buf
}

/// Create a window with typical editor dimensions
pub fn create_window(height: u16) -> Window {
    Window {
        id: WindowId::new(0),
        source: WindowContentSource::FileBuffer { buffer_id: 0 },
        bounds: WindowRect::new(0, 0, 120, height),
        z_order: 0,
        is_active: true,
        is_floating: false,
        viewport: Viewport::default(),
        config: WindowConfig {
            line_number: Some(LineNumber::default()),
            sign_column_mode: SignColumnMode::No,
            scrollbar_enabled: false,
            border_config: None,
        },
    }
}
