musescore / musescore/MuseScore
[API] Selection no longer working
Open
@igorkorsukov is already working on this.
Since Jul 16, 2025.
community
needs review
plugins
regression MS4
- Dominant language
- C++
- Stars
- 15.1k
- Forks
- 3.3k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 91
Description
Issue type
Other type of issue
Description with steps to reproduce
- Open MuseScore.
- Create a blank, one-staff score with 32 measures.
- Run this simple plugin:
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
onRun: {
if (true) {
cmd("select-all")
} else {
curScore.selection.selectRange(0, 1920, 0, 1)
}
curScore.startCmd()
var text = newElement(Element.STAFF_TEXT)
text.text = curScore.selection.elements.length.toString()
var c = curScore.newCursor()
c.rewind(Cursor.SCORE_START)
c.track = 0
c.add(text)
curScore.endCmd()
}
}
Expected result: A new staff text element with the text '32' is added to the score.
Actual result: Nothing happens.
Supporting files, videos and screenshots
What is the latest version of MuseScore Studio where this issue is present?
4.5.2 and master
Regression
Yes, this used to work in a previous version of MuseScore 4.x
Operating system
Windows 10
Additional context
Select-All:
- This works as intended in MuseScore 4.2.0, but not 4.3.2.
Select range:
- MuseScore 4.2.0 selects the range, but adds a text saying '0'. Presumably the selection state is not updated until
endCmd()is called. Has no effect in 4.3.2+
Checklist
- This report follows the guidelines for reporting bugs and issues
- I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
- I have attached all requested files and information to this report
- I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.