sane focus

This commit is contained in:
🪞👃🪞 2024-06-21 13:52:21 +03:00
parent be2c2df92b
commit 3177e4ab58
2 changed files with 13 additions and 3 deletions

View file

@ -48,7 +48,17 @@ pub fn render (state: &Chain, buf: &mut Buffer, area: Rect)
}, },
ChainView::Column => { ChainView::Column => {
let (area, areas) = draw_column(&state.items, buf, area, 0)?; let (area, areas) = draw_column(&state.items, buf, area, 0)?;
draw_box_styled(buf, area, Some(Style::default().dim())) draw_box_styled(buf, area, Some(if state.focused {
Style::default().dim()
} else {
Style::default().not_dim()
}));
draw_box_styled(buf, areas[state.focus], Some(if state.focused {
Style::default().green().not_dim()
} else {
Style::default().green().dim()
}));
area
}, },
}) })
//let area = Rect { x, y, width: 40, height: 30 }; //let area = Rect { x, y, width: 40, height: 30 };

View file

@ -49,7 +49,7 @@ pub fn render (state: &Plugin, buf: &mut Buffer, Rect { x, y, .. }: Rect)
Some(PluginKind::LV2(ports, instance)) => { Some(PluginKind::LV2(ports, instance)) => {
let mut height = 3; let mut height = 3;
for (i, port) in ports.iter().skip(state.parameter_offset).enumerate() { for (i, port) in ports.iter().skip(state.parameter_offset).enumerate() {
if i >= 20 { if i >= 30 {
break break
} }
buf.set_string(x + 2, y + 3 + i as u16, &format!("{:30} = {:03}", buf.set_string(x + 2, y + 3 + i as u16, &format!("{:30} = {:03}",
@ -58,7 +58,7 @@ pub fn render (state: &Plugin, buf: &mut Buffer, Rect { x, y, .. }: Rect)
), Style::default()); ), Style::default());
height = height + 1; height = height + 1;
} }
Ok(draw_box(buf, Rect { x, y, width: 50, height: height.max(20) })) Ok(draw_box(buf, Rect { x, y, width: 50, height: height.max(30) }))
}, },
_ => { _ => {
buf.set_string(x + 1, y + 3, &format!(" Parameter 1 0.0"), style); buf.set_string(x + 1, y + 3, &format!(" Parameter 1 0.0"), style);