From f2fdf3dd129db330cf098adafe6439ea568e5663 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Wed, 4 Dec 2024 01:10:18 +0100 Subject: [PATCH] full block piano roll, pt.4 --- crates/tek_tui/src/tui_view_phrase_editor.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/tek_tui/src/tui_view_phrase_editor.rs b/crates/tek_tui/src/tui_view_phrase_editor.rs index db596c84..f2787561 100644 --- a/crates/tek_tui/src/tui_view_phrase_editor.rs +++ b/crates/tek_tui/src/tui_view_phrase_editor.rs @@ -267,11 +267,16 @@ impl PhraseViewMode { for (x, target_x) in (x0..x0+w).enumerate() { for (y, target_y) in (y0..y0+h).enumerate() { let source_x = time_start + x; - let source_y = note_hi - y; - let target_cell = target.get_mut(target_x, target_y); - target_cell.set_char('x'); - if let Some(source_cell) = source.get(source_x, source_y) { - *target_cell = source_cell.clone(); + let source_y = note_hi - y; + // TODO: enable loop rollover: + //let source_x = (time_start + x) % source.width.max(1); + //let source_y = (note_hi - y) % source.height.max(1); + if source_x < source.width && source_y < source.height { + let target_cell = target.get_mut(target_x, target_y); + target_cell.set_char('x'); + if let Some(source_cell) = source.get(source_x, source_y) { + *target_cell = source_cell.clone(); + } } } }