Skip to content

fix(lang): a bar's text takes in its slashes, its tie and its commands - #115

Merged
fts-forge[bot] merged 1 commit into
mainfrom
fix/bar-spans
Nov 18, 2026
Merged

fts-forge[bot] merged 1 commit into
mainfrom
fix/bar-spans

Conversation

@fts-forge

@fts-forge fts-forge Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

A bar's text in the source now takes in what goes with its chord: its slashes (G ////), a tie at its end (Dm_8 ~), a command (\fermata).

The bug

A chord that fills its bar opens the next bar as it is read. So the slashes, tie or command written after it were counted as the next bar's text, or dropped at the end of a line. An edit of the bar then wrote over the chord alone and left the rest behind: G //// with a new quality became Gmaj7_1 ////. That is a bar too many, so the write was refused ("Section Pre(Chorus) has 9 parsed measures but header specifies 8").

The fix

A slash group, a ~ or a \command that adds nothing to the bar it opened on, and comes right after a token that ended a bar exactly, belongs to the bar before (bar_spans).

Dev vault (edit_vault, 2,700 bars)

before after
a note entered and written back 1,956 2,164
a chord entered and written back 2,064 2,194
writes refused 533 325

The biggest gains are in charts written a bar per line in slashes: She's American 79 → 122 notes, Hey! 53 → 88, Drive To LA 56 → 83.

Tests

  • New: a_bar_s_text_takes_in_its_slashes_and_its_tie, covering G ////, G //// C ////, G_1 ~ and D_1 \fermata.
  • Changed: the held-chord test now expects bar 1 written E /// G#m / (its trailing slash is now its own) instead of E /// G#m. Both read back the same, and the write is checked.
  • Not fixed: a chord followed by spaced slashes (G / / / / C / / / /) still shares its text with the next bar. Such a run is still edited by writing it out bar by bar.
  • just ci: passes on the stack's top (2,610 passed, 51 skipped).

A chord that fills its bar (`G ////`, `Dm_8 ~` at a bar's end) opens the
next bar as it is read, so the slashes, tie or command written after it
were counted as the next bar's text, or dropped at the line's end. An
edit of the bar then wrote over the chord alone and left the rest:
`G ////` became `Gmaj7_1 ////`, a bar too many, and the write was
refused. Such a token, putting nothing in the bar it opened on, is now
the bar's before it.

Dev vault: notes entered and written back 1,956 -> 2,164, chords
2,064 -> 2,194; refusals 533 -> 325.
@fts-forge
fts-forge Bot merged commit f6e050a into main Nov 18, 2026
8 checks passed
fts-forge Bot added a commit that referenced this pull request Nov 18, 2026
Palette cells apply to the selected chord. Stacked on #115 (bar spans).

## What a cell does
A cell click runs `KEYFLOW_PALETTE_APPLY {token}`, the action ⌘K and MCP
run too, on the chord symbol selected on the chart. It is one edit and
one undo step.
- **Chord qualities** (maj7, m7, 7, m7♭5, dim7, aug, sus4, 7sus, add9,
6, 9, m9): set the chord's quality and keep its root, bass and marks.
`'F#m7/A` + maj7 → `'F#maj7/A`.
- **Accent and staccato:** go on the chord, or off when they are on
(`>G`, `.G`).
- **Push and push 16:** refused, with the reason in the status line. A
push moves the chord ahead of its beat (into the bar before when it is
on a downbeat). A bar's chord line doesn't place that offset yet, so the
write-back check refused it.
- **Every other cell** says it isn't placed yet and gives its token to
type: sections, keys, time signatures, tempi, repeats, dynamics, text,
marcato, fermata, stop, tie.
- **On a replayed bar:** the edit goes to the bar it plays, as retyping
does.

## A bar's own style kept
An edited bar used to be written with values, so `G ////` became
`Gmaj7_1`, one whole-note slash where the author had four. A bar written
in beat slashes, with no values, is now written in slashes again when
its chords are whole beats (`Gmaj7 ////`, `D // G //`). It falls back to
values when that doesn't read back the same. The vault's edit counts are
unchanged by this; only how a bar is written changes.

## Checked in the app
Isolated Architect at `9d1f2f48`, *Drive To LA*: I selected the G at bar
19 and clicked `maj7`. It engraved as G△7, and the file line went from
`G ////` to `Gmaj7_1`. That was before the slash-style commit; with it,
the line is written `Gmaj7 ////`, which the tests check but I didn't
recheck in the app. Before #115 the same click was refused (a bar too
many).

## Tests
- **New:**
`a_palette_cell_sets_the_selected_chord_s_quality_or_marks_it` (a
quality, the accent and staccato on and off, a push refused with why, a
downbeat chord accented, nothing selected) and
`every_cell_applies_or_says_why_not`. In `chords`: `with_quality` and
`with_mark`.
- **Changed:** expectations for bars first written in slashes: `C /
Gsus4 ///` rather than `C_4 Gsus4_2.`, and `D // G //` rather than `D_2
G_2`.
- **`just ci`:** 2,610 passed, 51 skipped.

## Not done
Lasso and multi-chord selections apply to the chord last clicked, not to
every chord in the lasso. The cells that place things in a bar or a
section (keys, meters, tempi, sections, repeats, dynamics, cues) are the
next piece.
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.

0 participants