Skip to content

Fix #33883: Account for accidentals in other voices when spacing chord brackets#33983

Merged
miiizen merged 3 commits into
musescore:mainfrom
pyonpyoco:fix/chord-bracket-spacing
Jul 14, 2026
Merged

Fix #33883: Account for accidentals in other voices when spacing chord brackets#33983
miiizen merged 3 commits into
musescore:mainfrom
pyonpyoco:fix/chord-bracket-spacing

Conversation

@pyonpyoco

Copy link
Copy Markdown
Contributor

Resolves: #33883

Chord bracket placement previously used only the owning chord shape, so accidentals from another voice in the same segment/staff could be ignored.
This change includes chord shapes from other voices in the same segment and owning staff, restricted to the same visual staff.

2026-06-28_161823_light.mp4
  • I signed the CLA as username: 9zu8co
  • 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 Jun 28, 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: 4c009fb3-149e-4d97-a57e-c1a1a510dc21

📥 Commits

Reviewing files that changed from the base of the PR and between 3afb319 and 7e1b02c.

📒 Files selected for processing (2)
  • src/engraving/rendering/score/chordlayout.cpp
  • src/engraving/rendering/score/tlayout.cpp
💤 Files with no reviewable changes (2)
  • src/engraving/rendering/score/chordlayout.cpp
  • src/engraving/rendering/score/tlayout.cpp

📝 Walkthrough

Walkthrough

ChordLayout::layoutChords1 now performs an additional pass after segment elements are laid out to relayout chord-bracket items and refresh chord shapes when brackets are present. TLayout::layoutChordBracket now uses a new internal helper to compute a composite obstacle shape from matching chords in the same segment and staff before calculating horizontal spacing.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the bug fix and matches the main change in chord bracket spacing.
Description check ✅ Passed The description includes the issue reference, a concise motivation, and the required checklist structure.
Linked Issues check ✅ Passed The code updates chord bracket spacing to account for other voices in the same visual staff, matching #33883.
Out of Scope Changes check ✅ Passed The changes are narrowly focused on chord-bracket spacing and relayout behavior, with no obvious unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. 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.

@mathesoncalum mathesoncalum requested a review from miiizen June 29, 2026 07:33

@miiizen miiizen 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.

This is a good start, but we're going to have to take it further. We can't have this causing collisions with the barline as you see in the video.

Comment thread src/engraving/rendering/score/tlayout.cpp
Comment thread src/engraving/rendering/score/tlayout.cpp Outdated
@pyonpyoco pyonpyoco force-pushed the fix/chord-bracket-spacing branch from 3afb319 to 7e1b02c Compare July 4, 2026 06:03
@pyonpyoco

Copy link
Copy Markdown
Contributor Author

@miiizen Thank you for the review.
I addressed the two review comments. I also found that chord brackets needed to be laid out after the other segment elements had their final layouts, so I added a final re-layout pass for them.

2026-07-04_145523_light.mp4

@pyonpyoco pyonpyoco requested a review from miiizen July 4, 2026 06:47
@miiizen miiizen merged commit 7b9314a into musescore:main Jul 14, 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.

Chord bracket not shifting when adding accidentals

4 participants