Can't paste text into tuplet

• Dec 14, 2018 - 02:26
Reported version
P0 - Critical
S4 - Minor

We disallow normal paste of a range selection into a tuplet for good reason, but there is no particular reason we need to disallow it when pasting list selections - chord symbols, fingering, etc. Consider:


No particular reason we can't allow pasting the two chords in the first measure (Ctrl+click both, copy) into the second measure. Same if there were lyrics on, say, an eighth and two sixteenths - these could be pasted onto the three notes of a triplet. Only range selections, where notes need to be treated with their original durations, really present a problem


We are really only disallowing the paste if the first ChordRest of the destination is part of a tuplet. If there really is a potential problem with pasting a range selection into a tuplet, we should be able to produce it, even with the current check in place. I have experimented with disabling the checks here and here, and I have not been able to produce a problem.

Edit: Okay, so the problem is when pasting into the middle of a tuplet, not the beginning of the tuplet.

Since we disallow the copying of partial tuplets, and we can successfully handle pasting over the beginning of a tuplet, we can just disallow the paste if the destination ChordRest is not the beginning of its topTuplet. That will allow you to paste the copied Harmonies either onto the first note of the tuplet, or into the measure. And you can still paste a single Harmony onto a ChordRest in the middle of a tuplet. Would that be sufficient? Or would you like to be able to paste multiple Harmonies onto a ChordRest in the middle of a tuplet?

In theory, there is no particular reason it shouldn't work to paste that first measure into pretty much any 4/4 measure, even if it contains, say, a half note triplet (and thus no segment on beat 3). We create segments where needed if there no tuplets, it should work the same way if there are tuplets. Having a segment in the middle of a tuplet isn't normally a problem as long as it doesn't contain a chord rest on that track. And I can enter a chord symbol on beat three on a half note triplet perfectly fine - click the first note, Ctrl+K, enter first chord, hit ";" (shortcut for next beat) twice, enter next chord.

Not saying it's critical that paste be able to do this too, but really, it should be possible.

I was suggesting something like changing the line
else if (cr->tuplet()) {
else if (cr->tuplet() && (cr->afrac() != cr->topTuplet()->afrac())) {
in the two places I linked to above. This will allow you to do what you are trying to do. It wouldn't matter if the Harmony split the tuplet, but you would not be able to begin the paste in the middle of the tuplet.

Well, if it is in a different voice, there is no problem. As far as this is concerned, that would not even be considered pasting into the middle of the tuplet.

I take it back. Pasting a range into a segment that splits a tuplet does cause a problem in current master. But I think I know how to fix it.

Well, I tried changing the line to
else if (cr->segment()->splitsTuplet()) {
It fixes your problem, and it does not introduce any new bugs. But it does not fix the problem I just found. Turns out Segment::splitsTuplet() only knows about a tuplet if one of the tuplet's elements is in the segment's own elist.

Status PR created fixed

Fixed in branch master, commit 5f079ced2c

_fix #52906, fix #279990, fix #288019: relax restrictions on pasting to tuplets

1) Pasting symbol lists (lyrics, dynamics, chord symbols etc.) to
tuplets work correctly so we don't need to impose any restrictions

2) Pasting a staff range to the first chord/rest of a tuplet correctly
replaces the tuplet with the clipboard content. We need to restrict
pasting a range only if trying to paste to the middle of a tuplet._

Fix version