Repository navigation
Commit 5857bae
authored
fix(lang): a bar a chord is pushed into has its own text; a pushed chord reads at its written place (#121)
The largest group of read-only bars left: a chord pushed onto the next
bar's downbeat (*Know Me*'s `4 '6m // 5 //`). 49 bars, now none.
## Cause
As it reads a pushed chord, the parser opens the bar the push comes from
and then takes it back. Tokens read in between were marked as starting
in a bar they ended before (`before 2 after 1`). So the bar after a push
shared its line's text with the next bar, and writing that run out bar
by bar was refused. A token is now placed in the bar it ended in
(`bar_spans`). The line read as written and read bar by bar (`4 | '6m //
5 //`) are the same music, which the write-back check confirms.
A bar's chord line also reads each pushed chord at its written place:
where it sounds plus its push. A chord pushed onto the downbeat is then
the bar's first chord, instead of an out-of-order chord at its end, and
the bar is no longer locked. This replaces the slot shifting #117 did
after the fact.
## What an edit does now
- **Editing after the pushed chord:** written in place (`'6m // 5 //` →
`'6m // 5maj7 //`).
- **Retyping the pushed chord:** keeps its push (`'2m`), so the bar
before is unchanged.
- **Taking the push off, or overwriting it with an unpushed chord:**
would change the bar before (its last chord would sound to the barline
again). It is refused, and the status line says which bar.
## Dev vault (2,700 bars)
| | before | now |
|---|---:|---:|
| read-only | 94 | **41** |
| pushed over a barline | 49 | **0** |
| notes entered and written back | 2,182 | **2,442** |
| chords entered and written back | 2,281 | **2,314** |
| note writes refused | 316 | **105** |
*Know Me*: all 154 bars take a note (was 22). 93 take a chord typed at
the downbeat; on the rest, the downbeat is a pushed chord, and a chord
typed there without a push is refused, as above.
## Still read-only (41)
| why | bars |
|---|---:|
| a replayed section whose source bar is refused, or not found (10 in
*This Christmas*) | 24 |
| a `<< >>` block written over several lines | 15 |
| an `x2` copy that differs from its first pass (*Sleigh Ride*) | 2 |
## Tests
- **Replaced:**
`a_bar_a_push_crosses_into_has_its_own_text_and_is_edited` replaces the
read-only test. It covers: every bar of *Know Me*'s intro has its own
text; an edit after the pushed chord; a retype that keeps the push;
taking the push off refused.
- **Changed:** the held-chord tests expect the untouched run to be
written `B /// C#sus2 / | C#sus2` (each bar now has its own text). It
reads back the same.
- **`just ci`:** passes (2,616 passed, 51 skipped). No `Cargo.lock`
change.4 files changed
Lines changed: 69 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
| |||
87 | 100 | | |
88 | 101 | | |
89 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
90 | 107 | | |
91 | 108 | | |
92 | 109 | | |
93 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
94 | 114 | | |
95 | 115 | | |
96 | 116 | | |
| |||
124 | 144 | | |
125 | 145 | | |
126 | 146 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 147 | | |
150 | 148 | | |
151 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1131 | 1130 | | |
1132 | 1131 | | |
1133 | 1132 | | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | 1133 | | |
1150 | | - | |
1151 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1152 | 1137 | | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
1153 | 1163 | | |
1154 | 1164 | | |
1155 | 1165 | | |
| |||
1346 | 1356 | | |
1347 | 1357 | | |
1348 | 1358 | | |
1349 | | - | |
| 1359 | + | |
1350 | 1360 | | |
1351 | 1361 | | |
1352 | 1362 | | |
| |||
1506 | 1516 | | |
1507 | 1517 | | |
1508 | 1518 | | |
1509 | | - | |
| 1519 | + | |
1510 | 1520 | | |
1511 | 1521 | | |
1512 | 1522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1260 | 1260 | | |
1261 | 1261 | | |
1262 | 1262 | | |
1263 | | - | |
| 1263 | + | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
989 | 1001 | | |
990 | 1002 | | |
991 | 1003 | | |
| |||
0 commit comments