Skip to content

Palette search cannot find sharp or flat key signatures typed as "F#" or "Bb" - #34395

Open
macaquedev wants to merge 1 commit into
musescore:mainfrom
macaquedev:palette_search_accidentals
Open

Palette search cannot find sharp or flat key signatures typed as "F#" or "Bb"#34395
macaquedev wants to merge 1 commit into
musescore:mainfrom
macaquedev:palette_search_accidentals

Conversation

@macaquedev

@macaquedev macaquedev commented Jul 29, 2026

Copy link
Copy Markdown

Resolves: #34394

Palette item names contain the real accidental signs — F♯ major / D♯ minor, B♭ major / G minor — and palette search matched them with a plain substring test against the name. Since neither ♯ nor ♭ is on a standard keyboard layout, none of the ways a user can actually type an accidental found anything: F#, F sharp, Bb and B flat all returned no results. The only search that worked was a bare F, which returns every palette item containing that letter.

PaletteCellFilterProxyModel now accepts an item if the search text occurs in any of three spellings of its name:

example
as displayed F♯ major / D♯ minor
ASCII shorthand F# major / D# minor
spelled out F sharp major / D sharp minor

Two points worth flagging for review:

  • The words used for the spelled out form go through muse::qtrc, so the alternative spellings follow the language the item names are displayed in rather than being hardcoded English. This adds two translatable strings to the palette context, "%1 sharp" and "%1 flat", each with a disambiguation explaining that it is a search alternative for an accidental sign. %1 is the character the sign follows, so languages that attach the accidental to the note letter instead of writing it as a separate word can translate them as "%1is" / "%1es" and get Fis / Ges.
  • This is not specific to key signatures — it applies to any palette item whose name contains ♯ or ♭.

Palette search filtering speed has been tuned in the past, so the alternative spellings are only built for names that actually contain an accidental sign. Every other name takes an early return and does the same single substring test as before.

The palette module had no unit tests, so this adds a palette_tests target. It covers the three spellings plus the pre-existing behaviour of matching a palette's name to show all of its cells. The expected cell names come from TConv::translatedUserName rather than string literals, so the tests keep exercising the real names if those are ever reworded. I confirmed the two new-behaviour tests fail when the change is reverted. The UTest configuration disabled the palette module, which would have left the new target unbuilt, so that line is gone from SetupConfigure.cmake.

  • I signed the CLA as macaquedev
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds configurable palette test builds and a new palette search filter. Search supports musical accidental symbols, ASCII shorthand, spelled-out names, regular palette names, and parent palette matching. PaletteProvider now supplies search text through the specialized proxy model. New GTest coverage validates these search formats and unknown-query behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.37% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #34394 by supporting Unicode, ASCII, and spelled-out sharp and flat searches for palette items.
Out of Scope Changes check ✅ Passed The build configuration, implementation, and unit tests directly support the linked issue and PR objectives.
Title check ✅ Passed The title clearly identifies the palette search problem for ASCII sharp and flat notation.
Description check ✅ Passed The description explains the problem, implementation, tests, issue reference, and completed checklist items.
✨ 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: 1

🤖 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 `@CMakeLists.txt`:
- Line 141: Update the UTest configuration block in CMakeLists.txt so enabling
MUE_BUILD_PALETTE_TESTS also forces MUE_BUILD_PALETTE_MODULE on, overriding the
UTest default. Preserve the existing palette-test option behavior and ensure the
real palette target is used so palette_tests is added.
🪄 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 Plus

Run ID: 02cc38aa-77e2-484d-bbb3-5435b469d3fe

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0f3d7 and f72e144.

📒 Files selected for processing (9)
  • CMakeLists.txt
  • SetupConfigure.cmake
  • src/palette/CMakeLists.txt
  • src/palette/internal/palettemodel.cpp
  • src/palette/internal/palettemodel.h
  • src/palette/internal/paletteprovider.cpp
  • src/palette/internal/paletteprovider.h
  • src/palette/tests/CMakeLists.txt
  • src/palette/tests/palettesearch_tests.cpp

Comment thread CMakeLists.txt
@avvvvve
avvvvve requested a review from mathesoncalum July 31, 2026 13:59
Comment thread src/palette/internal/palettemodel.cpp Outdated
Comment thread src/palette/internal/palettemodel.cpp Outdated
@mathesoncalum

This comment was marked as resolved.

@macaquedev

This comment was marked as resolved.

Palette item names use the real accidental signs, e.g. "F♯ major /
D♯ minor", but neither ♯ nor ♭ is on a standard keyboard layout.
Search did a plain substring match on those names, so "F#", "F sharp",
"Bb" and "B flat" all returned no results, leaving a bare "F" as the
only way to look for a sharp or flat key signature.

PaletteCellFilterProxyModel now matches an item if the search text
occurs in its name, in its ASCII shorthand ("F# major / D# minor") or
in its spelled out form ("F sharp major / D sharp minor"). The spelled
out names are translatable patterns taking the character the sign
follows, so languages that attach the accidental to the note letter
instead of writing it as a separate word can do so, e.g. "%1is" for
German "Fis".

This applies to every palette item whose name contains an accidental
sign, not just key signatures.

The palette module is no longer disabled in the UTEST configuration,
so that the new palette_tests target is actually built and run.

Resolves: musescore#34394
@macaquedev
macaquedev force-pushed the palette_search_accidentals branch from f72e144 to 3d924ca Compare August 3, 2026 13:36
@mathesoncalum

This comment was marked as resolved.

@macaquedev

This comment was marked as resolved.

@mathesoncalum

This comment was marked as resolved.

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.

Palette search cannot find sharp or flat key signatures typed as "F#" or "Bb"

4 participants