fix: clamp bar values to width that is available
This commit is contained in:
@@ -446,8 +446,10 @@ impl Drop for AudioVisualizer {
|
||||
fn render_visualizer(f: &mut Frame, area: Rect, bar_values: &[u64]) {
|
||||
const BLOCKS: [&str; 8] = ["▂", "▃", "▄", "▅", "▆", "▇", "█", "█"];
|
||||
|
||||
let max_bars = area.width as usize;
|
||||
let line: String = bar_values
|
||||
.iter()
|
||||
.take(max_bars)
|
||||
.map(|&val| {
|
||||
if val == 0 {
|
||||
" "
|
||||
|
||||
Reference in New Issue
Block a user