feat(editor): toggleable follow-playhead (Shift+L) - #113
Conversation
📝 WalkthroughWalkthroughThis PR adds a Shift+L follow-playhead toggle. Playback auto-scroll now depends on a persisted editor preference that defaults on, with a test covering the scroll target behavior and a changelog update. ChangesFollow-playhead toggle
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.44.1)screen.jsast-grep timed out on this file Comment |
d946219 to
2d8f56a
Compare
Roadmap 2.3 parity cluster. The playback auto-scroll was unconditional; it is now gated on a follow pref (default ON — unchanged behavior) so an author can pin the view on one passage and keep editing while the song plays. Registry command `toggleFollow` with Shift+L in both profiles; the scroll policy math is extracted into @pure:follow-scroll and pinned by tests (the follow-off case fails on main). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JEoFeTPSnz4NpwwCG52hnu
2d8f56a to
2119566
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/follow_toggle.test.js (1)
16-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFragile regex+eval extraction for the pure block.
Extracting
_followScrollTargetPurevia regex on comment markers and evaluating withnew Functionis brittle — reformatting the@pure:follow-scrollmarkers or block whitespace in screen.js would silently break this test's ability to locate/eval the function. Consider having screen.js export the pure function (e.g., conditionalmodule.exportsfor Node) andrequireit directly instead.♻️ Suggested direction (screen.js side)
+if (typeof module !== 'undefined' && module.exports) { + module.exports = { _followScrollTargetPure }; +}// tests/follow_toggle.test.js const { _followScrollTargetPure } = require('../screen.js');🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/follow_toggle.test.js` around lines 16 - 24, The current test setup in follow_toggle.test.js is brittle because it locates _followScrollTargetPure by regexing the `@pure`:follow-scroll markers in screen.js and then evaluating the block with new Function. Update screen.js to expose _followScrollTargetPure as a normal export for Node so the test can load it directly with require, and remove the marker-based extraction logic from the test while keeping the existing function name and behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/follow_toggle.test.js`:
- Around line 16-24: The current test setup in follow_toggle.test.js is brittle
because it locates _followScrollTargetPure by regexing the `@pure`:follow-scroll
markers in screen.js and then evaluating the block with new Function. Update
screen.js to expose _followScrollTargetPure as a normal export for Node so the
test can load it directly with require, and remove the marker-based extraction
logic from the test while keeping the existing function name and behavior
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a46318cb-9ccd-41d8-b803-d9c13ee3ed9d
📒 Files selected for processing (3)
CHANGELOG.mdscreen.jstests/follow_toggle.test.js
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
- screen.js
|
@coderabbitai Thanks — skipping the |
|
Tip For best results, initiate chat on the files or code changes.
(⁀ᗢ⁀) noted for future reviews ✏️ Learnings added
|
…ggle # Conflicts: # CHANGELOG.md # screen.js
Roadmap 2.3 (parity cluster). The other 2.3 items — seek-to-note / next-prev note/beat/grid/anchor — already shipped in the earlier waves; this adds the missing follow toggle.
What
The playback auto-scroll (view jumps once the playhead crosses 80% of the window, landing it at 30%) was unconditional. It''s now gated on a follow pref — default ON, behavior unchanged — so an author can pin the view on one passage and keep editing while the song plays on. New registry command
toggleFollow, bound Shift+L in both FeedBack Native and EOF Legacy profiles (collision-checked). Editor pref only, never pack data. The scroll policy math moves into a@pure:follow-scrollblock.Tests
tests/follow_toggle.test.js: the 80%-trigger/30%-landing policy pinned exactly, the at-threshold non-trigger, and the follow-off null (fails on main, where the scroll is unconditional). Full JS suite: 42 files green.Fresh region vs the open queue — playbackTick''s scroll block + registry rows only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JEoFeTPSnz4NpwwCG52hnu
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation