Can't paste text into tuplet
Reported version
3.0
Priority
P0 - Critical
Type
Functional
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
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
Fix version
3.3.3
Comments
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()) {
to
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.
Oh, I understand now. Yes, that's fine, there would no "easy" way to select that point anyhow (multiple voices, multi-staff selections, I guess).
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.
Came up again, worth fixing.
See https://github.com/musescore/MuseScore/pull/5486
This implements a solution suggested by @mattmcclinch but also allows pasting list selections to tuplets without any restrictions as they seem to make no sense here. The issue with splitting a tuplet by a paste operation to another voice should probably be addressed separately.
Isn't this then a duplicate of #52906: Can't paste lyrics into tuplet?
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
here.
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._
Fixed in branch master, commit fb09b011b8
_Merge pull request #5486 from dmitrio95/cannot-paste-into-tuplet
fix #52906, fix #279990, fix #288019: relax restrictions on pasting to tuplets_
Automatically closed -- issue fixed for 2 weeks with no activity.