MuseScore
MuseScore copied to clipboard
Show element on select/insert/append at start/end of score
Resolves: https://github.com/musescore/MuseScore/issues/14579
The commands to select firs/last element of score, as well as inserting measures/frames/text, do not automatically show the selected element. This change adds the necessary showItem() calls.
- [x] I signed CLA
- [x] I made sure the code in the PR follows the coding rules
- [x] I made sure the code compiles on my machine
- [x] I made sure there are no unnecessary changes in the code
- [x] I made sure the title of the PR reflects the core meaning of the issue you are solving
- [x] I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
- [x] I made sure the commit message title starts with "fix #424242:" if there is a related issue
- [ ] I created the test (mtest, vtest, script test) to verify the changes I made
I suspect there are other commands that still don't position the score view, but this fixes the ones I've seen reported or that I've noticed myself:
- Ctrl+Home / Ctrl+End - these select the first or last element, but don't current position the score as they did in MU3
- Insert measures - inserting at start or end of score did not position view there as it did in MU3
- Add / Text / Title etc - this adds a frame at the start of the score if necessary and allows to start typing, but again, the view wasn't being positioned there. This also affects ordinary text like staff text or lyrics, which could also sometimes be entered off-screen if the note/measure you had selected was near the edge.
I'd like to add Shift+Left/Right/Up/Down, also Shift+Ctrl+Left/Right (see https://github.com/musescore/MuseScore/issues/14691), or I could do that in a separate PR. Should just be another call to showItem in addToSelection() in this same file.
I added it in a second commit - it's just the one line.
The vtest failure is not due to this PR but to my recently-merged chord symbol formatting change. Not sure how that's supposed to be working. Anyhow, the PR build is working as expected for me.
This just came up again on Discord. Would be nice to have this merged. As noted, the test failure is not real.
@MarcSabatella please rebase it
Closed in favor of https://github.com/musescore/MuseScore/pull/15451 - same code but rebased into one commit