#86

fix(lyrics): keep active line stable across position jitter

OpenJustMarkDevwants to merge intofrom

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

12
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]1mo ago

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.

FindingLocation
🆕 🟡 MediumBackward hold swallows single-line step back on dense lyricssrc/lyrics.ts:210
🆕 🔵 LowStale highlight held across in-place lyrics reloadsrc/lyrics.ts:208
Prompt for all open findings
  • In src/lyrics.ts around 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.
  • In src/lyrics.ts around lines 195-212 and src/main.ts around lines 1360-1387, fix the reload hold: applyLyrics replaces lyricsLines without resetting activeLineIndex, so after a same-length word-sync shift (line 2 9000→10000 at position 9600) the stale index 2 is held instead of 1; reset activeLineIndex on lyrics replacement so reloads follow position directly.
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]reviewed1mo ago
opencode-agent[bot]1mo ago

Review · 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.

FindingLocation
✅ FixedBackward hold swallows single-line step back on dense lyricssrc/lyrics.ts:215
✅ FixedStale highlight held across in-place lyrics reloadsrc/main.ts:1372