Skip to content

Fix #212 — draw back-to-back bars as written - #215

Merged
sbeitzel merged 1 commit into
developfrom
feature/fix_212
Oct 4, 2026
Merged

sbeitzel merged 1 commit into
developfrom
feature/fix_212

Conversation

@sbeitzel

@sbeitzel sbeitzel commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Fix #212

Summary

Engrave what is written: a bar written straight after another bar is a second bar, and is now drawn whole, wherever it falls, as abcm2ps 8.14 draws it.

  • Line start after a bar of its own (:| ending one line, :: opening the next): drawn whole (:][:) instead of only its start-repeat half. The same goes for |, ||, :|, |], which were dropped before. Leftmost ink starts where a |:'s thick line does, matching abcm2ps; |: itself does not move.
  • Mid-line pairs (| |, |] [|, || ||, :| :|, :| ::, :| |:): both bars drawn, ~2.4 staff spaces apart (measured from abcm2ps), instead of one on top of the other.
  • Head of the tune: a written opening bar is drawn.
  • Unchanged: a bar ending a line is not restated on the next, and a :: on a break is still split (A |: at the end of a line is drawn past the staff end, and again at the start of the next line #197). Variant endings render identically. Bars VoiceAligner pads with are never treated as written.

How

SizedMeasure gains ownsOpeningBar (the opening bar is not the previous measure's closing bar restated) and openingBarLead (the room it needs ahead of its anchor). The renderer's sizing loop tracks each voice's last closing bar to decide ownership. The lead differs mid-line and at a system start, so it uses the existing systemStartMeasures sizing. VerticalLayoutEngine draws an owned bar at its offset.

Differs from abcm2ps

abcm2ps merges :| |: into a single ::. This PR draws both bars, per the draw-what-is-written principle in the issue.

Tests

RepeatAtSystemBreakTests adds tests for line-start bars, line-end bars not restated, and mid-line pairs; they fail without the fix. Full suite passes (788 + 694 + 22) with no snapshot changes.

🤖 Generated with Claude Code

A bar written in its own right — after a bar of its own, as in `:| ::`
or `| |`, or at the head of the tune — is now drawn whole wherever it
falls, as abcm2ps draws it, rather than dropped or drawn on top of the
bar before it.

- The sizer records whether a measure owns its opening bar (it is not
  the previous measure's closing bar restated) and the lead that bar
  needs: ~2.4 staff spaces clear of the bar it follows mid-line, and
  at the head of a system its leftmost ink where a `|:`'s thick line
  starts.
- VerticalLayoutEngine draws an owned bar whole at that offset; a bar
  split across a system break (#197) is handled as before.
- Bars VoiceAligner pads with are never owned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sbeitzel
sbeitzel merged commit 2271411 into develop Oct 4, 2026
2 checks passed
@sbeitzel
sbeitzel deleted the feature/fix_212 branch October 4, 2026 04:01
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.

1 participant