Skip to content

Act IV opens: The Selection (visual mode) + Inner Sanctum (inner text objects)#9

Merged
StrangeNoob merged 2 commits into
mainfrom
feature/act4-part1
Jul 3, 2026
Merged

Act IV opens: The Selection (visual mode) + Inner Sanctum (inner text objects)#9
StrangeNoob merged 2 commits into
mainfrom
feature/act4-part1

Conversation

@StrangeNoob

@StrangeNoob StrangeNoob commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

The Archives open — 24 of 29 curriculum lessons shipped. Two medium engine features land: charwise visual mode and the inner text objects every vim daily-driver uses.

New lessons

Act Lesson Teaches
IV · 23 The Selection v + motions + d/y/c on the selection
IV · 24 Inner Sanctum ci" di( dip

Engine

  • Visual mode: v anchors; h j k l w b e 0 $ ^ shape the selection; d/x/y/c operate on it; esc/v leave. Multi-row deletes splice; multi-row yanks degrade to linewise (documented); undo restores the selection's start. Selection is reverse-video highlighted and the HUD shows -- VISUAL --
  • Inner objects: i" picks the surrounding (or next) quoted span like Vim; i( finds the innermost pair, nesting-aware; ip takes the paragraph block, preserving surrounding blanks; c variants insert
  • Gate fix (root cause): object/delimiter completions of an armed operator now bypass allowedKeys — previously di('s ( cost a heart. Same rationale as the existing r/f pending-char bypass
  • 19 new engine test cases; one test expectation corrected against real-vim behavior (multi-line v j d leaves both surrounding spaces)

Act IV scaffolding

  • Brass palette, THE ARCHIVES, act summary, four-act welcome + title copy
  • Content rules: acts 1..4; a boss only on its act's final lesson; every act except the highest must end with one — the final act may grow boss-less until The Macro Forge (29) ships with The Archivist. Until then the game finale is intentionally unreachable, and the finale test asserts exactly that

Test plan

  • go test ./... green (24 lessons, all solvable at par)
  • go vet, gofmt -l clean
  • Binary builds; version smoke run

Summary by CodeRabbit

  • New Features
    • Added a fourth act with new lessons covering visual mode and inner selection/text-object editing.
    • Visual mode now shows selection highlighting in the editor and a clear HUD indicator.
  • Bug Fixes
    • Updated lesson progression so act finales only trigger at the correct end-of-act boss.
    • Expanded supported editing actions for selections, quotes, parentheses, and paragraphs.
  • Documentation
    • Updated the README, curriculum docs, and welcome/title screens to reflect the new four-act journey.

…\"/i(/ip)

The Archives begin: 24 of 29 curriculum lessons shipped.

Engine:
- Charwise visual mode: v anchors a selection, a motion subset shapes it,
  d/x/y/c operate on it (multi-row splice; y degrades to linewise across
  rows), esc/v leaves; undo restores the selection's start
- Inner text objects beyond iw: i\" (quoted span, or the next one ahead,
  like Vim), i( (innermost pair, nesting-aware, line-local), ip (the
  paragraph block, blanks preserved; cip collapses to one line)
- AllowedKeys gate now skips object/motion completions of an operator
  already in flight — di( no longer costs a heart for the \"(\"

UI:
- Selection is reverse-video highlighted in the buffer; -- VISUAL -- HUD
- Act IV scaffolding: brass palette, THE ARCHIVES name/summary, welcome
  screen and title tagline now speak of four acts

Content rules:
- Act range widened to 1..4; a boss may sit only on its act's final
  lesson, and every act except the highest (under construction) must
  end with one. The finale test now asserts mid-game bosses do NOT
  trigger the finale; the full check returns with The Macro Forge

Lessons: The Selection (act4-23, v/vy/vc) and Inner Sanctum (act4-24,
ci\"/di(/dip), solutions verified at par.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@StrangeNoob, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 59c1a7e6-f0d3-498d-92f8-480ae6049eec

📥 Commits

Reviewing files that changed from the base of the PR and between 5be2130 and ccd4fce.

📒 Files selected for processing (7)
  • README.md
  • internal/engine/edit.go
  • internal/engine/engine.go
  • internal/engine/inner_objects_test.go
  • internal/engine/visual.go
  • internal/ui/app_test.go
  • internal/ui/room.go
📝 Walkthrough

Walkthrough

This PR adds a fourth curriculum act ("The Archives") introducing Visual mode and additional inner-text-object operators (quotes, parentheses, paragraphs) to the Vim emulation engine, wires corresponding UI rendering/HUD/theming, adds two new lesson JSON files, and updates docs and tests to reflect 24 shipped lessons and revised boss-placement rules.

Changes

Act IV Feature: Visual Mode + Inner Objects

Layer / File(s) Summary
Inner text-object operators
internal/engine/edit.go, internal/engine/inner_objects_test.go, internal/content/solvable_test.go
applyOperator gains dispatch for di"/ci", di(/ci(, dip/cip via new helpers cutInnerSpan, innerQuote, innerParen, innerParagraph; new tests and solvability solutions cover these operations.
Visual mode engine
internal/engine/engine.go, internal/engine/visual.go, internal/engine/visual_test.go
Adds ModeVisual, VisualAnchor, v key entry, pressVisual dispatch, Selection, deleteSelection, yankSelection, and adjusts AllowedKeys gating; tested via table-driven cases.
UI rendering, HUD, and theming
internal/ui/room.go, internal/ui/styles.go, internal/ui/title.go, internal/ui/welcome.go, internal/ui/cmdline_hud_test.go
Renders visual selection highlighting, shows -- VISUAL -- HUD label, adds Act IV palette/name/summary, updates title/welcome copy to reflect four acts.
Finale trigger test revision
internal/ui/app_test.go
Replaces the finale test so completion requires the final act's boss rather than the previously-last lesson's boss.
Act IV lesson content
assets/lessons/act4-23-the-selection.json, assets/lessons/act4-24-inner-sanctum.json
Adds two new lessons with challenges, buffers, goals, hints, and keys for selection and inner-object editing.
Docs and content-loader validation
README.md, docs/LESSON-GAP-ANALYSIS.md, docs/LESSONS.md, internal/content/loader_test.go
Updates docs to describe four acts, 24 shipped lessons, and revised boss-placement rules; updates loader test to allow acts 1–4 and validate per-act boss placement.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Simulator
  participant pressVisual
  participant deleteSelection
  participant yankSelection
  User->>Simulator: press("v")
  Simulator->>Simulator: set Mode=ModeVisual, VisualAnchor=cursor
  User->>Simulator: press motion keys
  Simulator->>pressVisual: dispatch keys
  User->>Simulator: press("d"/"x")
  pressVisual->>deleteSelection: delete selected span
  deleteSelection-->>Simulator: updated Buffer/Cursor
  User->>Simulator: press("y")
  pressVisual->>yankSelection: yank selected span
  yankSelection-->>Simulator: updated register/Cursor
Loading
sequenceDiagram
  participant Simulator
  participant applyOperator
  participant innerQuote
  participant innerParen
  participant innerParagraph
  participant cutInnerSpan
  Simulator->>applyOperator: press("d"/"c" + "i" + target)
  applyOperator->>innerQuote: target == "\""
  applyOperator->>innerParen: target == "(" / ")" / "b"
  applyOperator->>innerParagraph: target == "p"
  innerQuote->>cutInnerSpan: cut(a, b)
  innerParen->>cutInnerSpan: cut(a, b)
  cutInnerSpan-->>Simulator: updated Buffer/Cursor/Mode
Loading

Possibly related PRs

  • StrangeNoob/nvim-quest#2: Both PRs modify finale/results logic in internal/ui/app_test.go around when resGameComplete is triggered relative to the final boss.
  • StrangeNoob/nvim-quest#3: Both PRs extend the same "pending inner" operator mechanism in internal/engine/edit.go/engine.go, from iw to additional inner text objects.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: opening Act IV with the two new lessons, visual mode, and inner text objects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/act4-part1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…, visual gating, rune-safe highlight

- innerParen guards the empty line (di( panicked; regression test added)
- The allowedKeys bypass is now exactly as wide as an armed inner-object
  prefix: delimiters complete di"/ci( freely, but an armed operator no
  longer smuggles count digits past the gate (test added)
- Visual-mode commands respect allowedKeys like normal-mode ones (esc free)
- renderSelected slices by rune, matching the cursor-render path
- Finale test fails loudly if no boss lesson exists
- README: palette list gains archive brass; boss claim scoped to Act IV's
  under-construction state
@StrangeNoob

Copy link
Copy Markdown
Owner Author

CodeRabbit CLI review disposition (7 findings):

  • di( empty-line panic (critical): confirmed and fixed — reproduced with a regression test first (index out of range), then guarded.
  • Gate bypass too broad (major): valid, tightened further than suggested — the bypass is now scoped to an armed pendingInner prefix only, so di"/ci( delimiters pass but an armed operator can't smuggle count digits past the gate. Regression test covers both directions.
  • Visual mode ungated (major): fixed — visual commands now respect allowedKeys (esc always free), matching normal mode.
  • Rune-unsafe selection highlight (major): fixedrenderSelected now slices by rune like the cursor-render path.
  • Test -1 guard (minor): fixed.
  • README boss claim (minor): fixed — palette list and boss sentence now name Act IV's under-construction state.
  • Visual d/x don't fill the register (major): intentionally skipped — no delete in this engine fills the register (documented simplification, see PR The operators pack: The Severing (D/C/ce/yw) + The Gatekeeper (%) #7 disposition and the gap analysis); doing it only for visual would be inconsistent.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 `@docs/LESSONS.md`:
- Line 13: The inline schema example is inconsistent with the updated lesson
naming rule, because it still describes act as 1..3 while the new rule in the
same section says ACT is 1–4. Update the schema example in the lessons guide so
the act range matches the current rule, keeping the reference aligned with the
lesson ordering description that mentions ORDER and sorting by (act, order).

In `@internal/ui/app_test.go`:
- Around line 245-252: The boss-selection setup in the test can leave last as -1
when no lesson has a Boss, which later causes awardBoss() to index m.lessons
with an invalid lessonIdx. Add a guard after the loop in the test around
m.lessonIdx/m.inBoss assignment (using the same pattern as
TestNextActAnnouncementOnBossClear) and fail the test with a clear message if no
boss lesson is found, so the failure happens before any invalid indexing.

In `@README.md`:
- Line 3: The README overview is out of sync with the new four-act tagline
because the journey map still ends at Act III. Update the primary overview
section to include the added Act IV so the headline and the act breakdown match,
using the existing journey map/act section in README as the place to extend.
🪄 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: 69692c7e-1aee-42f3-9622-f7a564ae91fb

📥 Commits

Reviewing files that changed from the base of the PR and between e72a1a3 and 5be2130.

⛔ Files ignored due to path filters (1)
  • docs/lessons.csv is excluded by !**/*.csv
📒 Files selected for processing (18)
  • README.md
  • assets/lessons/act4-23-the-selection.json
  • assets/lessons/act4-24-inner-sanctum.json
  • docs/LESSON-GAP-ANALYSIS.md
  • docs/LESSONS.md
  • internal/content/loader_test.go
  • internal/content/solvable_test.go
  • internal/engine/edit.go
  • internal/engine/engine.go
  • internal/engine/inner_objects_test.go
  • internal/engine/visual.go
  • internal/engine/visual_test.go
  • internal/ui/app_test.go
  • internal/ui/cmdline_hud_test.go
  • internal/ui/room.go
  • internal/ui/styles.go
  • internal/ui/title.go
  • internal/ui/welcome.go

Comment thread docs/LESSONS.md
```

`ACT` is 1–3 and `ORDER` is the global lesson order (lessons are sorted by `(act, order)`).
`ACT` is 1–4 and `ORDER` is the global lesson order (lessons are sorted by `(act, order)`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the schema example to match the new act range.

The file-naming rule now says ACT is 1–4, but the inline schema example still says act is 1..3, so the guide contradicts itself.

Suggested fix
-  "act": 2,                            // 1..3
+  "act": 2,                            // 1..4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`ACT` is 1–4 and `ORDER` is the global lesson order (lessons are sorted by `(act, order)`).
`ACT` is 1–4 and `ORDER` is the global lesson order (lessons are sorted by `(act, order)`).
🤖 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 `@docs/LESSONS.md` at line 13, The inline schema example is inconsistent with
the updated lesson naming rule, because it still describes act as 1..3 while the
new rule in the same section says ACT is 1–4. Update the schema example in the
lessons guide so the act range matches the current rule, keeping the reference
aligned with the lesson ordering description that mentions ORDER and sorting by
(act, order).

Comment thread internal/ui/app_test.go
Comment thread README.md
@StrangeNoob StrangeNoob merged commit f6d808e into main Jul 3, 2026
2 checks passed
@StrangeNoob StrangeNoob deleted the feature/act4-part1 branch July 3, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant