The finale: Block Party (Ctrl-v) + The Macro Forge (q/@) + The Archivist — curriculum complete#11
Conversation
… Archivist
The curriculum is complete: all 29 lessons across four acts shipped, and
clearing The Archivist re-arms the game finale.
Engine:
- Visual block (ctrl+v): a rectangular selection reshaped by h/j/k/l/0/$;
d/x cut its columns; I inserts a prefix and A appends a suffix on every
row of the block when Insert closes on esc. Not dot-repeatable
- Macros: q{reg}…q records a keystroke stream (the closing q excluded);
@{reg} replays it through the real key path; @@ repeats the last macro.
A depth guard bounds self-invoking macros. Macros use a store separate
from the yank registers (documented)
UI:
- -- VISUAL BLOCK -- HUD, rectangular reverse-video highlight, and a
"● REC" indicator while a macro records
Content:
- Block Party (act4-28): column prefix (I) and suffix (A) edits
- The Macro Forge (act4-29): record/replay and @@, carrying the boss
The Archivist (dip → block-I → macro capstone). Boss steps verified
solvable through the engine
- Finale reachable again: clearing the final boss shows the mastery
screen; a mid-game boss does not (both asserted)
Docs: LESSONS.md / lessons.csv / README / gap analysis all mark the
curriculum complete — 29/29, no consensus gaps remain.
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds Visual Block (ctrl-v) editing mode and macro recording/replay (q/@) to the editing engine, integrates them into UI rendering and HUD, adds two new lessons ("Block Party" and "The Macro Forge" with boss "The Archivist"), and updates curriculum docs and tests to reflect a completed 29-lesson curriculum. ChangesVisual Block & Macro Engine Feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Simulator
participant Room as UI/room.go
User->>Simulator: ctrl+v
Simulator->>Simulator: enter ModeVisualBlock, set BlockAnchor
Room->>Simulator: BlockSelection()
Room->>Room: renderBlockSelected (reverse-video rectangle)
User->>Simulator: I / d / x
Simulator->>Simulator: startBlockInsert or deleteBlock
User->>Simulator: type text, esc
Simulator->>Simulator: finishBlockInsert replicates across rows
Room->>Room: renderHUD shows "-- VISUAL BLOCK --"
sequenceDiagram
participant User
participant Simulator
participant Room as UI/room.go
User->>Simulator: q, a
Simulator->>Simulator: arm pendingQ, start recording register a
Room->>Room: renderHUD shows "● REC"
User->>Simulator: keystrokes, q
Simulator->>Simulator: store macroKeys into macros[a]
User->>Simulator: @, a
Simulator->>Simulator: runMacro replays keys via Press, guarded by macroDepth
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@internal/engine/engine.go`:
- Around line 157-165: The macro recording path in Press is currently appending
keystrokes even when they are being replayed by runMacro, which causes nested or
replayed macro input to be captured into macroKeys and duplicated on later runs.
Update the recording guard around the s.macroKeys append in Press to skip
appending while playback is active, using the existing s.replaying or
s.macroDepth state. Keep the normal s.record and dispatch flow intact, but
ensure only user-entered keys are recorded when recordingMacro is true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: fac19598-ed7b-429f-a812-05756eb98fc9
⛔ Files ignored due to path filters (1)
docs/lessons.csvis excluded by!**/*.csv
📒 Files selected for processing (15)
README.mdassets/lessons/act4-28-block-party.jsonassets/lessons/act4-29-the-macro-forge.jsondocs/LESSON-GAP-ANALYSIS.mddocs/LESSONS.mdinternal/content/loader_test.gointernal/content/solvable_test.gointernal/engine/edit.gointernal/engine/engine.gointernal/engine/macro_test.gointernal/engine/visual.gointernal/engine/visual_block_test.gointernal/ui/app_test.gointernal/ui/cmdline_hud_test.gointernal/ui/room.go
| // Macro recording captures every key except the q that ends it. | ||
| if s.recordingMacro && !s.stopsMacro(key) { | ||
| s.macroKeys = append(s.macroKeys, key) | ||
| } | ||
| s.record(key) | ||
| ev := s.dispatch(key) | ||
| s.finishRecord(key, ev) | ||
| return ev | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm there is no replay/depth guard on the macroKeys append and that `.`
# is handled before the append.
rg -nP -C4 'macroKeys\s*=\s*append' internal/engine/engine.go
rg -nP -C2 'repeatLastChange|s\.replaying' internal/engine/engine.goRepository: StrangeNoob/nvim-quest
Length of output: 1542
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the relevant sections around Press, record/replay, and macro playback.
sed -n '140,260p' internal/engine/engine.go
printf '\n----\n'
sed -n '520,570p' internal/engine/engine.goRepository: StrangeNoob/nvim-quest
Length of output: 4771
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the q/@ handling and macro state transitions.
rg -n -C4 'recordingMacro|lastMacroReg|pendingQ|pendingAt|runMacro|stopsMacro|macroKeys|macros\[|@' internal/engine/engine.goRepository: StrangeNoob/nvim-quest
Length of output: 4172
Skip replayed keystrokes while recording macros. runMacro re-enters Press while recordingMacro is still enabled, so recording @b inside another macro appends b’s expansion to macroKeys and makes later replays duplicate it. Guard the append during playback, for example with s.replaying or s.macroDepth > 0.
🤖 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 `@internal/engine/engine.go` around lines 157 - 165, The macro recording path
in Press is currently appending keystrokes even when they are being replayed by
runMacro, which causes nested or replayed macro input to be captured into
macroKeys and duplicated on later runs. Update the recording guard around the
s.macroKeys append in Press to skip appending while playback is active, using
the existing s.replaying or s.macroDepth state. Keep the normal s.record and
dispatch flow intact, but ensure only user-entered keys are recorded when
recordingMacro is true.
- Pending() now reports pendingQ/pendingAt so the HUD shows a macro register prompt, consistent with the other pending-key states - TestMidGameBossIsNotTheFinale also asserts the act-complete unlock, covering the positive path alongside the not-finale assertion
|
CodeRabbit CLI review disposition (4 minor findings) The CLI review is incremental — the first run surfaced all 4, and re-runs on the same commit dedupe to 0. Addressed by file:
Full suite green; |
Summary
The last two lessons and the final boss. The curriculum is complete: all 29 lessons across four acts are shipped, and clearing The Archivist triggers the game's mastery finale.
New lessons (29/29)
Ctrl-vvisual block + columnI/Aq{reg}…qrecord,@{reg}replay,@@Engine
ctrl+v): rectangle reshaped byh/j/k/l/0/$;d/xcut the columns;Iprefixes andAsuffixes every row of the block when the insert closes onesc(the typed text replicates down the column, like Vim). Not dot-repeatableq{reg}records the raw keystroke stream (the stoppingqexcluded),@{reg}replays it through the realPresspath so it obeysallowedKeys,@@repeats the last. A depth guard bounds self-invoking macros. Macros live in a store separate from the yank registers — a deliberate simplification, noted in the gap analysisUI
-- VISUAL BLOCK --mode line, rectangular reverse-video highlight, and a red● RECindicator while recordingFinale
Clearing the final boss now sets
resGameCompleteand shows the mastery screen (TestFinaleOnFinalBoss); a mid-game boss does not (TestMidGameBossIsNotTheFinale).Test plan
go test ./...green (29 lessons solvable at par; boss steps verified)go vet,gofmt -lcleanversionsmoke runSummary by CodeRabbit
New Features
Bug Fixes
Documentation