pub fn scroll_window(text: &str, width: usize, frame: usize) -> String {
let width = width.max(1);
let pad = " ".repeat(width);
let scroll = format!("{}{}{}", pad, text, pad);
let total = scroll.chars().count();
if width >= total {
return scroll;
}
let max_start = total - width;
let start = frame % (max_start + 1);
scroll.chars().skip(start).take(width).collect()
}
pub fn vertical_offset(output: &str, offset: usize) -> String {
let mut result = String::new();
for _ in 0..offset {
result.push('\n');
}
result.push_str(output);
result
}