editor::paste fix a thinko in undo nesting

This commit is contained in:
Ben Loftis 2022-05-09 14:44:05 -05:00
parent 5310e1e099
commit dbe49ae8c4
2 changed files with 10 additions and 11 deletions

View File

@ -5173,6 +5173,7 @@ Editor::paste_internal (timepos_t const & pos, float times)
R1.A1, R1.A2, R2, R2.A1, ... */
}
bool commit = false;
begin_reversible_command (Operations::paste);
if (ts.size() == 1 && cut_buffer->lines.size() == 1 &&
@ -5181,7 +5182,7 @@ Editor::paste_internal (timepos_t const & pos, float times)
"greedy" paste from one automation type to another. */
PasteContext ctx(paste_count, times, ItemCounts(), true);
ts.front()->paste (position, *cut_buffer, ctx);
commit |= ts.front()->paste (position, *cut_buffer, ctx);
} else {
@ -5189,13 +5190,17 @@ Editor::paste_internal (timepos_t const & pos, float times)
PasteContext ctx(paste_count, times, ItemCounts(), false);
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
(*i)->paste (position, *cut_buffer, ctx);
commit |= (*i)->paste (position, *cut_buffer, ctx);
}
}
++paste_count;
commit_reversible_command ();
if (commit) {
commit_reversible_command ();
} else {
abort_reversible_command ();
}
}
void

View File

@ -3837,7 +3837,7 @@ MidiRegionView::duplicate_selection ()
paste (dup_pos, local_selection, ctxt);
}
/** This method handles undo */
/** undo commands were initiated at the 'action' level. ::paste and ::paste_internal should implement subcommands */
bool
MidiRegionView::paste (timepos_t const & pos, const ::Selection& selection, PasteContext& ctx)
{
@ -3865,17 +3865,11 @@ MidiRegionView::paste (timepos_t const & pos, const ::Selection& selection, Past
const ATracks& atracks = midi_view()->automation_tracks();
for (ATracks::const_iterator a = atracks.begin(); a != atracks.end(); ++a) {
if (a->second->paste(pos, selection, ctx)) {
if(!commit) {
trackview.editor().begin_reversible_command (Operations::paste);
}
commit = true;
}
}
if (commit) {
trackview.editor().commit_reversible_command ();
}
return true;
return commit;
}
/** undo commands were initiated at the 'action' level. ::paste and ::paste_internal should implement subcommands */