Skip to content

added notation selection target#34247

Merged
igorkorsukov merged 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step16
Jul 17, 2026
Merged

added notation selection target#34247
igorkorsukov merged 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step16

Conversation

@igorkorsukov

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3ab99517-478d-457b-a587-3992f0177f8c

📥 Commits

Reviewing files that changed from the base of the PR and between ea126df and b70d58c.

📒 Files selected for processing (11)
  • muse
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/notationtypes.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationactioncontroller.h
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/notationscene/internal/notationcommandsstate.cpp
  • src/notationscene/notationcommands.h
🚧 Files skipped from review as they are similar to previous changes (9)
  • muse
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/notationcommands.h
  • src/notation/notationtypes.h
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/inotationinteraction.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notation/internal/notationinteraction.cpp

📝 Walkthrough

Walkthrough

Selection handling was consolidated around SelectionTarget and PlayMode types. NotationInteraction gained target dispatch and similarity/chord-note selection operations, while legacy movement handling was adjusted. New selection commands, aliases, command-state entries, and compatibility mappings were added. NotationActionController now parses selection queries, forwards them to notation interaction, and optionally seeks or plays the result. The muse subproject pointer was updated separately.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing the required template sections and checklist items. Add the issue reference, a short motivation/summary, and complete the repository checklist items from the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly describes the main change: adding a notation selection target.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/muse_framework.git.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/notation/internal/notationinteraction.cpp`:
- Around line 1037-1040: Update the selection-change handling after
score->selectSimilarInRange(lastHit) to use notifyAboutSelectionChangedIfNeed()
instead of directly checking selectionChanged() and notifying. Preserve the
existing notification behavior while ensuring the helper clears
Score::selectionChanged() before or as part of notification.

In `@src/notationscene/internal/notationactioncontroller.cpp`:
- Around line 3174-3190: Update NotationActionController::registerAliases so the
dispatched alias checks the state for the alias command itself, rather than
query.uri() (which resolves to SELECT_COMMAND). Use the alias key captured for
each registration when consulting commandsState(), preserving the existing
NotSupported response and handler dispatch behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0629dcb0-03a3-4fea-8b50-6934509b6174

📥 Commits

Reviewing files that changed from the base of the PR and between 4d3e04e and ea126df.

📒 Files selected for processing (11)
  • muse
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/notationtypes.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationactioncontroller.h
  • src/notationscene/internal/notationcommandsregister.cpp
  • src/notationscene/internal/notationcommandsstate.cpp
  • src/notationscene/notationcommands.h

Comment thread src/notation/internal/notationinteraction.cpp
Comment on lines +3174 to +3190
void NotationActionController::registerAliases(const std::map<muse::rcommand::Command, muse::rcommand::CommandQuery>& aliases,
void (NotationActionController::*handler)(const muse::rcommand::CommandQuery&))
{
for (auto it = aliases.cbegin(); it != aliases.cend(); ++it) {
auto alias = it->first;
auto query = it->second;

commandDispatcher()->onRequest(this, alias, [this, query, handler]() {
if (!commandsState()->commandState(query.uri()).enabled) {
return muse::make_ret(Ret::Code::NotSupported);
}

(this->*handler)(query);
return muse::make_ok();
});
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Check the dispatched alias’s state, not SELECT_COMMAND.

Every stored query has SELECT_COMMAND as its URI, so selection-required aliases bypass their states from HAS_SELECTION_REQUIRED_COMMANDS. This also lets remapped legacy actions report success without a selection.

Proposed fix
-        commandDispatcher()->onRequest(this, alias, [this, query, handler]() {
-            if (!commandsState()->commandState(query.uri()).enabled) {
+        commandDispatcher()->onRequest(this, alias, [this, alias, query, handler]() {
+            if (!commandsState()->commandState(alias).enabled) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void NotationActionController::registerAliases(const std::map<muse::rcommand::Command, muse::rcommand::CommandQuery>& aliases,
void (NotationActionController::*handler)(const muse::rcommand::CommandQuery&))
{
for (auto it = aliases.cbegin(); it != aliases.cend(); ++it) {
auto alias = it->first;
auto query = it->second;
commandDispatcher()->onRequest(this, alias, [this, query, handler]() {
if (!commandsState()->commandState(query.uri()).enabled) {
return muse::make_ret(Ret::Code::NotSupported);
}
(this->*handler)(query);
return muse::make_ok();
});
}
}
void NotationActionController::registerAliases(const std::map<muse::rcommand::Command, muse::rcommand::CommandQuery>& aliases,
void (NotationActionController::*handler)(const muse::rcommand::CommandQuery&))
{
for (auto it = aliases.cbegin(); it != aliases.cend(); ++it) {
auto alias = it->first;
auto query = it->second;
commandDispatcher()->onRequest(this, alias, [this, alias, query, handler]() {
if (!commandsState()->commandState(alias).enabled) {
return muse::make_ret(Ret::Code::NotSupported);
}
(this->*handler)(query);
return muse::make_ok();
});
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/notationscene/internal/notationactioncontroller.cpp` around lines 3174 -
3190, Update NotationActionController::registerAliases so the dispatched alias
checks the state for the alias command itself, rather than query.uri() (which
resolves to SELECT_COMMAND). Use the alias key captured for each registration
when consulting commandsState(), preserving the existing NotSupported response
and handler dispatch behavior.

void findAndSelectChordRest(const Fraction& tick) override;
void moveSegmentSelection(MoveDirection d) override;

FilterElementsOptions elementsFilterOptions(const EngravingItem* element) const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make it private

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the next PR I will clean up this interface and class

@igorkorsukov
igorkorsukov merged commit afef486 into musescore:main Jul 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants