replace existing samples; dont crash on small screen

This commit is contained in:
🪞👃🪞 2024-07-20 20:22:56 +03:00
parent 5e75f97e09
commit 61c84ac030
2 changed files with 14 additions and 5 deletions

View file

@ -185,6 +185,9 @@ mod draw_vertical {
move |buf: &mut Buffer, area: Rect| {
for (_, y) in rows.iter() {
let y = area.y + (*y / 96) as u16 + 1;
if y >= buf.area.height {
break
}
for x in area.x..area.width+area.y-2 {
let cell = buf.get_mut(x, y);
cell.modifier = Modifier::UNDERLINED;

View file

@ -85,6 +85,12 @@ pub const KEYMAP_SAMPLER: &'static [KeyBinding<Sampler>] = keymap!(Sampler {
state.unmapped.push(sample);
Ok(true)
}],
[Char('r'), NONE, "sample_replace", "replace selected sample", |state: &mut Sampler| {
if let Some(sample) = state.sample() {
*MODAL.lock().unwrap() = Some(Exit::boxed(AddSampleModal::new(&sample)?));
}
Ok(true)
}],
[Enter, NONE, "sample_edit", "edit selected sample", |state: &mut Sampler| {
if let Some(sample) = state.sample() {
state.editing = Some(sample.clone());