Fixes #76.
While playing, position samples jitter backwards by a frame (stale fallback sample, pause reconcile). updateActiveLine picked the last line with timeMs <= position, so one jittery frame flipped the highlight to the previous line before moving on.
Holds the current line while playing unless playback falls more than ACTIVE_LINE_BACKWARD_MARGIN_MS (750ms, matching the pause reconcile tolerance) below the current line start; forward moves, paused scrubbing, and out-of-range highlights (lyrics reload) still follow the position directly.
Tests: vp test run src/lyrics.test.ts (33 passed), full vp test run (89 passed), vp check clean.
Activity
12Review · 60cbd74
✅ No blocking issues
This PR holds the lyric highlight across backward position jitter while playing via a 200 ms single-line hold, and clears the highlight in applyLyrics so reloads follow position. CI is still running for this head; the latest completed run on the branch (96ae50a) passed.
Confidence: 4/5 — both prior failure scenarios now return the correct line and are covered by new tests, with no new regressions found.
| Finding | Location | |
|---|---|---|
| ✅ Fixed | Backward hold swallows single-line step back on dense lyrics | src/lyrics.ts:215 |
| ✅ Fixed | Stale highlight held across in-place lyrics reload | src/main.ts:1372 |
Review · 96ae50a
⚠️ 2 open findings
This PR holds the lyric highlight across backward position jitter while playing via a 750 ms margin, with tests for jitter, seeks, and reloads. The biggest risk is the margin also swallows legitimate single-line steps back when lines are denser than 750 ms.
Confidence: 3/5 — logic is correct for the tested 5 s gaps but CI is still running and two hold-related edge cases are uncovered.
src/lyrics.ts:210src/lyrics.ts:208Prompt for all open findings
src/lyrics.tsaround lines 195-212, fix the dense-lyric hold:resolveActiveLineIndex([{0},{5000},{5400}], 5100, 2, true)returns 2 instead of 1 because the 750 ms margin exceeds the line gap; narrow the playing jitter window or condition the hold so a position squarely in the previous line still moves back while ~100 ms jitter still holds.src/lyrics.tsaround lines 195-212 andsrc/main.tsaround lines 1360-1387, fix the reload hold:applyLyricsreplaceslyricsLineswithout resettingactiveLineIndex, so after a same-length word-sync shift (line 2 9000→10000 at position 9600) the stale index 2 is held instead of 1; resetactiveLineIndexon lyrics replacement so reloads follow position directly.