diff --git a/cbd-tui/src/app/now_playing.rs b/cbd-tui/src/app/now_playing.rs index b324da4..2ee1740 100644 --- a/cbd-tui/src/app/now_playing.rs +++ b/cbd-tui/src/app/now_playing.rs @@ -17,10 +17,6 @@ use super::{COLOR_PRIMARY, COLOR_SECONDARY}; /// Vertical block glyphs by eighths, index 0 = empty, 8 = full cell. const BLOCKS: [char; 9] = [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█']; -/// Fixed height of the now-playing info block (4 text lines + border) -/// when the spectrum is shown; the spectrum then fills the rest. -const INFO_HEIGHT: u16 = 6; - /// Renders `bins` as full-height vertical bars filling a `width`×`height` /// area: one `Line` per row, top row first. Each column maps to a bin; /// its level in `[0, 1]` fills from the bottom, using partial block @@ -125,13 +121,16 @@ impl NowPlaying { } pub fn render(&self, f: &mut Frame, area: Rect) { - // With the spectrum on, the info block takes a fixed height, the - // progress a fixed row, and the spectrum fills whatever is left - // (`Min(0)`) so the bars are as tall as the pane allows. With it - // off, the info block fills as before. + // With the spectrum on, the info block takes exactly the height + // its content needs, the progress a fixed row, and the spectrum + // fills whatever is left (`Min(0)`) — so both size themselves and + // the bars are as tall as the pane allows. With it off, the info + // block fills as before. + let info_lines = if self.track.is_some() { 4 } else { 3 }; + let info_height = info_lines + 2; // + top and bottom border let constraints = if self.spectrum_enabled { vec![ - Constraint::Length(INFO_HEIGHT), + Constraint::Length(info_height), Constraint::Length(1), Constraint::Min(0), ]