mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
replace existing samples; dont crash on small screen
This commit is contained in:
parent
5e75f97e09
commit
61c84ac030
2 changed files with 14 additions and 5 deletions
|
|
@ -185,6 +185,9 @@ mod draw_vertical {
|
||||||
move |buf: &mut Buffer, area: Rect| {
|
move |buf: &mut Buffer, area: Rect| {
|
||||||
for (_, y) in rows.iter() {
|
for (_, y) in rows.iter() {
|
||||||
let y = area.y + (*y / 96) as u16 + 1;
|
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 {
|
for x in area.x..area.width+area.y-2 {
|
||||||
let cell = buf.get_mut(x, y);
|
let cell = buf.get_mut(x, y);
|
||||||
cell.modifier = Modifier::UNDERLINED;
|
cell.modifier = Modifier::UNDERLINED;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,12 @@ pub const KEYMAP_SAMPLER: &'static [KeyBinding<Sampler>] = keymap!(Sampler {
|
||||||
state.unmapped.push(sample);
|
state.unmapped.push(sample);
|
||||||
Ok(true)
|
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| {
|
[Enter, NONE, "sample_edit", "edit selected sample", |state: &mut Sampler| {
|
||||||
if let Some(sample) = state.sample() {
|
if let Some(sample) = state.sample() {
|
||||||
state.editing = Some(sample.clone());
|
state.editing = Some(sample.clone());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue