Skip to content

Fix #198 — %%stretchlast and %%stretchstaff, as abcm2ps implements them - #211

Merged
sbeitzel merged 1 commit into
developfrom
feature/fix_198
Oct 3, 2026
Merged

sbeitzel merged 1 commit into
developfrom
feature/fix_198

Conversation

@sbeitzel

@sbeitzel sbeitzel commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Fix #198

The last line of a tune was drawn at natural spacing, which packs eighths almost head to head next to the justified lines above it. It now behaves as abcm2ps 8.14.0 does (measured against its output):

  • %%stretchlast F (0…1, default 0.25): the last system is stretched to the line when its unstretched staff (header + music) reaches 1 − F of it. The spec's logical form is accepted as 1/0; values outside 0…1 are rejected with an invalidStretchLast warning, as abcm2ps rejects them.
  • A short last system takes the previous line's spacing, never below natural and never past the line. This is what fixes the issue's repro, whose last line is only 19% full.
  • %%stretchstaff false stretches no system at all. ckprobe --natural now forces it, so it reports natural widths for every system (with the rule above, %%stretchlast 0 no longer gives a natural last line).

API changes (need an ## Upgrading entry)

  • %%ceolkit:justifylast true|false is deprecated: parsed as %%stretchlast 1|0 with a deprecatedDirective warning.
  • CeolKitDirective.justifyLast(Bool) → .stretchLast(Double) and .stretchStaff(Bool).
  • SVGRenderConfig.justifyLastSystem → stretchLast (default 0.25) and stretchStaff (default true).
  • Justifier.justify/justifyGroups take stretchLast: (and optional stretchStaff:) in place of justifyLastSystem:.
  • The last line of most tunes changes.

Tests

  • Justifier: stretch threshold, previous-line spacing, stretchStaff: false.
  • Parser: %%stretchlast numbers/logicals/invalid values, %%stretchstaff, deprecated %%ceolkit:justifylast.
  • Re-recorded the Canzonetta and Zocharti Loch page snapshots (last systems now stretched or spaced like the line above). One style test was split because its fixture's full last line is now stretched by default.

Docs: EXTENSIONS.md, README.md, CLAUDE.md.

🤖 Generated with Claude Code

The last line of a tune was drawn at natural spacing, which packs eighths almost
head to head next to the justified lines above it. abcm2ps 8.14.0 does two things
instead, and CeolKit now does both:

- %%stretchlast F (0…1, default 0.25): the last system is stretched to the line
  when its unstretched staff reaches 1 − F of it.  The spec's logical form is
  accepted as 1/0.
- A last system that is not stretched is spaced like the line before it, never
  below natural and never past the line.

%%stretchstaff false stretches no system at all; ckprobe --natural now forces
it, so it reports natural widths for every system.

%%ceolkit:justifylast is deprecated: true/false parse as %%stretchlast 1/0
with a deprecatedDirective warning.  CeolKitDirective.justifyLast(Bool) is
replaced by .stretchLast(Double) and .stretchStaff(Bool), and
SVGRenderConfig.justifyLastSystem by stretchLast/stretchStaff — release notes
need an Upgrading entry, since the last line of most tunes changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sbeitzel
sbeitzel merged commit 7eb3509 into develop Oct 3, 2026
2 checks passed
@sbeitzel
sbeitzel deleted the feature/fix_198 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