feat: add modal controls for dialog inputs#206
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughAdds a ChangesVim Modal Input Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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 `@packages/tui/src/routes/session/question.tsx`:
- Around line 63-77: The motion state managed by createSingleLineVimMotions is
not being reset when leaving normal mode or when the editor transitions, so the
pending operator can leak across sessions and turn a later d into dd
unexpectedly. Update the question route’s input handling around answerMotions,
modalInputEnabled, and the shared modal controller so that any pending
motion/operator state is cleared whenever editing mode changes or focus returns,
matching the ownership expected by the modal controller.
- Around line 152-156: The key handler in question.tsx currently treats "a" the
same as "i" inside the input mode switch, so append mode never moves the caret
forward. Update the keyboard branch that handles key === "a" to advance the
textarea cursor one character before setting inputMode to "insert" and focusing
the textarea, using the same handler that manages the existing insert-mode
transition. If Vim-style append is not intended, remove the "a" case from this
key handling path.
In `@packages/tui/src/ui/dialog-select.tsx`:
- Around line 133-136: The shared end-navigation path in dialog-select.tsx can
call moveTo() with -1 when flat() is empty, which leaves the selection state
invalid after clearing filters. Update moveToEnd and the shared selection
handling around moveTo()/flat() so the target index is clamped or skipped when
there are no results, ensuring both the modal G jump and existing end navigation
never set store.selected to an invalid item.
In `@packages/tui/src/ui/modal-input-controls.ts`:
- Around line 43-48: The escape path in modal-input-controls should normalize
the caret before switching out of insert mode, because input.setMode("normal")
currently leaves the cursor at the insert position. Update the Esc branch in the
insert-mode handling so the caret is moved to the normal-mode character index
expected by createSingleLineVimMotions and the rest of this module, then clear
pending and prevent default as it already does.
In `@README.md`:
- Around line 191-199: The README section for “Modal dialog inputs” is too
narrow because vim_modal_input also affects custom question answers in the
session question flow. Update the wording in the Markdown docs to mention that
this setting controls modal editing in
packages/tui/src/routes/session/question.tsx as well, so users understand it
applies beyond searchable dialog inputs.
🪄 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: 090664af-9c79-41a8-8ff3-08ac027a0970
📒 Files selected for processing (10)
README.mdpackages/opencode/src/config/tui-migrate.tspackages/opencode/test/config/tui.test.tspackages/tui/src/config/index.tsxpackages/tui/src/routes/session/question.tsxpackages/tui/src/ui/dialog-select.tsxpackages/tui/src/ui/modal-input-controls.tspackages/tui/src/ui/single-line-vim-motions.tspackages/tui/test/modal-input-controls.test.tspackages/tui/test/single-line-vim-motions.test.ts
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 `@README.md`:
- Line 193: The README wording for the modal controls sentence should be updated
to use “question-answer” instead of “question answer” so the user-facing docs
read naturally. Locate the sentence in README.md that mentions searchable dialog
inputs and custom question answer inputs, and revise that phrase to “custom
question-answer inputs” while keeping the rest of the wording unchanged.
🪄 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: ce057b0b-e82d-4c64-bfa2-575ab4515915
📒 Files selected for processing (5)
README.mdpackages/tui/src/routes/session/question.tsxpackages/tui/src/ui/dialog-select.tsxpackages/tui/src/ui/modal-input-controls.tspackages/tui/test/modal-input-controls.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/tui/src/ui/modal-input-controls.ts
- packages/tui/test/modal-input-controls.test.ts
- packages/tui/src/routes/session/question.tsx
- packages/tui/src/ui/dialog-select.tsx
cd82804 to
1866e91
Compare
Adds vim modal controls to dialog inputs, including searchable pickers and custom question answers.
h/j/k/l,w/b/e,0/$,I/A,ddSummary by CodeRabbit
vim_modal_input, normalizes it as a boolean, and defaults totruewhen unset.