Better version of 6a57baf193

This also fixes Menu > Edit Delete "delete MIDI" operation.
Pressing backspace/delete calls "Delete Selection" which is
unrelated to MRV::cut_copy_clear.
This commit is contained in:
Robin Gareus 2022-07-14 01:23:04 +02:00
parent 2848cc5f38
commit b4a7c8a17d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -3764,6 +3764,7 @@ MidiRegionView::cut_copy_clear (Editing::CutCopyOp op)
if (op != Copy) { if (op != Copy) {
bool as_subcommand = false;
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
switch (op) { switch (op) {
@ -3771,21 +3772,17 @@ MidiRegionView::cut_copy_clear (Editing::CutCopyOp op)
break; break;
case Delete: case Delete:
case Clear: case Clear:
start_note_diff_command();
/* fallthrough */
case Cut: case Cut:
/* for Cut, Editor::cut_copy already started an undo operation,
* so we cannot call start_note_diff_command ()
*/
if (!_note_diff_command) { if (!_note_diff_command) {
_note_diff_command = _model->new_note_diff_command ("Cut"); _note_diff_command = _model->new_note_diff_command ("Cut");
as_subcommand = true;
} }
note_diff_remove_note (*i); note_diff_remove_note (*i);
break; break;
} }
} }
apply_note_diff (op == Cut); apply_note_diff (as_subcommand);
} }
} }