Cursor::rewind(0) doesn't work like expected

• Aug 23, 2014 - 12:40
Type
Plugins
Severity
S4 - Minor
Status
closed
Project

I understand that Cursor::rewind(0) should reset the cursor to the beginning of the current score. However, it doesn't always do:

cursor.rewind(2);
cursor.rewind(0);

After these two commands cursor.segment will be null.
When there's no selection and staffIdx is reset to 0 before calling rewind(0), it works like expected.
I attached a demonstration plugin to check.

Using 57ce3dc on Mac OS X 10.9.4

Attachment Size
cursorRewind.qml 523 bytes

Comments

Looks like I didn't really understand how rewind(0) is supposed to work.
However, what happend here is, that cursor.staffIdx=0 does not reset the voice number, so cursor.track might still be 3 for example. If voice 4 of the first staff is empty, rewind(0) will not go to the start of the score.
Maybe it's worth mentioning in the documentation that setting cursor.track instead of cursor.staffIdx before calling rewind(0) is a good idea...