Using click and drag + copy and paste breaks rhythmic division in subsequent bars
Closed this issue · 6 comments
Example to reproduce:
- create a new tab with 2 bars
- put a quarter note in the first bar and a whole note in the second bar
- select the quarter note and copy it
- paste it somewhere in the first bar
The whole note in the second bar changes into a quarter note tied to a dotted half note. It seems to affect both notes and rests in all subsequent bars, by the way.
precision: reproduced with Tuxguitar 1.6.4 (bug ported from 2.0beta fork together with "copy-paste selection" action)
Understood. Example in this case:
- "copy" stores 1 beat in clipboard
- "paste" starts by deleting 1 beat where caret is
- then it inserts the beat from clipboard
At step 2, everything after the caret is shifted 1-beat left. This transforms the whole note from second bar into a quarter (in first bar) tied to a dotted half (in second bar)
At step 3, beat is inserted and everything is shifted back 1-beat right.
Need to find a better method.
Thank you @buryoutougen for characterizing this issue. I've been "polluted" several times by this phenomenon without understanding what caused it. The damaged measures can be very far away when pasting, even off-screen, so such effects can be seen very late after the problem really occurred.
Once again: we shall be very cautious when re-using code from 2.0beta fork. After re-reading the code, I just tested with multiple voices: this can lead to very weird results, including invalid measures...
Complete re-writing of "paste selection" feature in progress.
see video: the bug mentioned in this issue + an illustration of the multi-voices issue. This ends up with 1 half + 3 quarters in a 4/4 measure
164.mp4
correction coming
That should be better now.
Implementation is quite complex, so I would not be surprised if there are still some bugs in corner cases.
Hopefully eventual side effects -if any- should remain local.
Fix is available from pre-release 2024-10-24 in both master and tuxguitar-next branches
Looks fine to me, I tested it a bit and I don't get damaged bars anymore.