Enter lyric melisma with the underscore key on non-US keyboards#33890
Open
jiyimeta wants to merge 1 commit into
Open
Enter lyric melisma with the underscore key on non-US keyboards#33890jiyimeta wants to merge 1 commit into
jiyimeta wants to merge 1 commit into
Conversation
A lyric melisma is entered with the underscore character. Its default shortcut is Shift+-, which only yields '_' on US-ANSI keyboards. On layouts where '_' is a dedicated key (e.g. Japanese JIS on macOS) or is produced by a different combination (AZERTY, QWERTZ, ...), the shortcut layer never routes the underscore key to the add-melisma action, so a melisma cannot be entered at all. Handle the underscore key directly in the notation view while editing lyrics: Key_Underscore with no modifiers is claimed in shortcutOverrideEvent() and dispatched to add-melisma in keyPressEvent(), bypassing the keyboard-layout-dependent shortcut path. The dispatch is deferred to the next event-loop turn so add-melisma's edit teardown does not run while the key event is still being delivered. Shift+- keeps working on US layouts, and non-lyrics text editing is unaffected. Refs musescore#14914 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0d18047 to
590cf78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #14914 (the Japanese-keyboard report; reproduced here on macOS) and #16492 (AZERTY).
A lyric melisma is entered with the underscore character, but its default shortcut is
Shift+-, which only produces_on US‑ANSI keyboards. On layouts where_is a dedicated key (e.g. Japanese JIS on macOS) or is produced by a different combination (French AZERTY, German QWERTZ, …), the shortcut layer never routes the underscore key to theadd-melismaaction, so a melisma cannot be entered at all.This handles the underscore key directly in the notation view while editing lyrics:
Qt::Key_Underscorewith no modifiers is claimed inshortcutOverrideEvent()and dispatched toadd-melismainkeyPressEvent(), bypassing the keyboard‑layout‑dependent shortcut path. The dispatch is deferred to the next event‑loop turn (matching how shortcut‑driven actions run) soadd-melisma's edit teardown does not run while the key event is still being delivered.Shift+-keeps working on US layouts, and non‑lyrics text editing is unaffected — the intercept is gated on actively editing aLyricselement.Scope / testing. Validated on a macOS JIS keyboard, where the dedicated
_key arrives asKey_Underscorewith no modifiers: pressing it now creates and extends a melisma (incl. consecutive presses);Shift+-still creates a melisma on a US layout; typing_in non‑lyrics text still inserts a literal underscore.Note that #14914 was reported on Windows, where
_is produced asShift+\(i.e. with a modifier). That path likely delivers a different key event and is not covered by this no‑modifier intercept, so it probably needs separate handling/verification on Windows. I deliberately usedRefsrather thanResolvesso #14914 isn't auto‑closed before the Windows case is confirmed.I couldn't add a unit test: the change lives in the live key‑event path (
shortcutOverrideEvent/keyPressEvent) and there's no existing harness for synthesisingQKeyEvents through the notation view. Happy to add one if you can point me at a suitable place.