pub fn render_above_indicator<'a>(
show: bool,
count: usize,
label: &str,
) -> Option<ratatui::text::Line<'a>> {
use ratatui::style::{Color, Style};
use ratatui::text::{Line, Span};
if show {
let plural = if count == 1 { "" } else { "s" };
Some(Line::from(Span::styled(
format!(" {} {}{} above", count, label, plural),
Style::default().fg(Color::DarkGray),
)))
} else {
None
}
}
pub fn render_below_indicator<'a>(
show: bool,
count: usize,
label: &str,
) -> Option<ratatui::text::Line<'a>> {
use ratatui::style::{Color, Style};
use ratatui::text::{Line, Span};
if show {
let plural = if count == 1 { "" } else { "s" };
Some(Line::from(Span::styled(
format!(" {} {}{} below", count, label, plural),
Style::default().fg(Color::DarkGray),
)))
} else {
None
}
}
pub fn render_scroll_indicators<'a>(
show_above: bool,
items_above: usize,
show_below: bool,
items_below: usize,
label: &str,
) -> Vec<ratatui::text::Line<'a>> {
let mut lines = Vec::new();
lines.extend(render_above_indicator(show_above, items_above, label));
lines.extend(render_below_indicator(show_below, items_below, label));
lines
}