From 497436978730e26633ebba642a68fa7f5d13ce2e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 18 Oct 2023 09:05:48 -0600 Subject: [PATCH] fix logic in MidiRegionView::select_matching_notes() to not add notes when asked not to --- gtk2_ardour/midi_region_view.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 74bebbc105..0d99c7c690 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2362,16 +2362,19 @@ MidiRegionView::select_notes (list notes, bool allow_auditio void MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend) { - bool have_selection = !_selection.empty(); uint8_t low_note = 127; uint8_t high_note = 0; MidiModel::Notes& notes (_model->notes()); _optimization_iterator = _events.begin(); - if (extend && !have_selection) { + if (_selection.empty()) { extend = false; } + if (!add && !extend && !_selection.empty()) { + clear_note_selection (); + } + /* scan existing selection to get note range */ for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {