Corruption possible by changing voice 2 note into voice 1
Ubuntu 14.04, GIT commit: 0891e57
The code to move notes between voices is limited, but unfortunately, not limited enough:
1) note entry
2) voice 1, whole note C
3) voice 2 (same measure), two half notes, both chords F & A
4) exit note entry mode
5) select A of second half note chord in voice 2
6) press voice 1 button
Result: note is moved to voice 1 even though it is "full" already with the whole note:
We should probably simply disallow moving things into voice 1. If there is an existing element (chord or test) in that voice, it is replaced, but there is no check that it's the right duration, and undo does not restore the original element, either.
Comments
Moreover, when I switch A from voice 2 to voice 1, I can't switch it back to voice 2.
Windows, b9e10df
Yes, this much is on purpose. You can only move a single note within a multi-note chord; you cannot move the entire chord, which is what you'd be doing. See #46841: Can change an individual not to voice 2, but not back to voice 1. As noted, it is impossible to handle all cases - we deliberately only handle the easy ones, where you can simply move the note with no other rewriting of the measure required.
I started to assign this to myself think I'd fix it by limiting it further (only moving notes between existing chords or where there is an explicit rest). But maybe someone else wants to fix it "for real"? That would mean checking the destination voice, using an exisiting chord if present, converting a rest to chord if a rets is present, shortening a preceding chordrest if necessary, etc.
I decided to see what I could do, I think I mostly have it.
https://github.com/musescore/MuseScore/pull/1757
The code itself works well. Almost too well - I find it surprising how easy it is to move notes from voice to voice. I worry a little that people might end up moving notes accidentally until they get used to it.
In the original example above, the result would be the whole note one voice 1 gets shortened to a half note, and the "A" is moved to voice 1. If you then move it back to voice 2 as per comment #1, it gets replaced by a rest in voice 1.
I have updated my PR based on suggestions from lasconic. It feels much better now. Notes are only moved if it can be done without changing duration or disturbing the surrounding notes.
But I hope there will be a pop-up alert with info why "this button doesn't work" so that you can't move the notes between voices. Or maybe user should have choice whether he wants to cut duration of note in the other voice or not?
Fixed in eeddc86529
Automatically closed -- issue fixed for 2 weeks with no activity.