13
0

fix logic in MidiRegionView::select_matching_notes() to not add notes when asked not to

This commit is contained in:
Paul Davis 2023-10-18 09:05:48 -06:00
parent b7b2189d95
commit 4974369787

View File

@ -2362,16 +2362,19 @@ MidiRegionView::select_notes (list<Evoral::event_id_t> notes, bool allow_auditio
void void
MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend) 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 low_note = 127;
uint8_t high_note = 0; uint8_t high_note = 0;
MidiModel::Notes& notes (_model->notes()); MidiModel::Notes& notes (_model->notes());
_optimization_iterator = _events.begin(); _optimization_iterator = _events.begin();
if (extend && !have_selection) { if (_selection.empty()) {
extend = false; extend = false;
} }
if (!add && !extend && !_selection.empty()) {
clear_note_selection ();
}
/* scan existing selection to get note range */ /* scan existing selection to get note range */
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {