Skip to content

fix(cli): bind space to toggle in multi-select questions#12142

Closed
IamCoder18 wants to merge 1 commit into
Kilo-Org:mainfrom
IamCoder18:fix/question-multiselect-space-toggle
Closed

fix(cli): bind space to toggle in multi-select questions#12142
IamCoder18 wants to merge 1 commit into
Kilo-Org:mainfrom
IamCoder18:fix/question-multiselect-space-toggle

Conversation

@IamCoder18

Copy link
Copy Markdown
Contributor

Issue

Closes #12141

Context

Multi-select questions used Enter (and the 1-9 digit shortcuts) to toggle options, which is inconsistent with the Space-toggles / Enter-confirms convention used by most checklist-style CLI tools (fzf, lazygit, btop, ...). It also left no obvious way to advance to the next question or the review tab without reaching for Tab/.

This rebinds multi-select to match that convention without touching single-select behavior, and updates the visible hints to match.

Implementation

The change is symmetric across the two CLI surfaces.

question.shared.ts

  • questionSelect (Enter handler) no longer toggles in multi-select — it advances to the next tab or the confirm/review tab.
  • New exported questionToggleAction carries the old toggle logic, including the custom-option branch (Space on a typed-but-unsaved value toggles it).
  • Hint text gains a space toggle segment and changes Enter's verb from togglecontinue when multiple === true.

kilo run footer (footer.question.tsx)

  • useKeyboard gets a space case that calls questionToggleAction.
  • choose(selected) (digit shortcuts) routes through questionToggleAction in multi-select so 1-9 keep their muscle-memory toggle, and through questionSelect in single-select so digits still submit.
  • Footer hint adds a space toggle row when multi-select is active.

Interactive TUI QuestionPrompt

  • New continueOption() helper handles Enter: advance in multi-select, pick + advance/submit in single-select.
  • Digit-shortcut binding toggles in multi-select and picks in single-select.
  • New space binding toggles the focused option only in multi-select (omitted from the binding list otherwise so it can't accidentally fire).
  • Footer hint swaps togglecontinue and adds a space toggle segment when multi-select is active.

Screenshots / Video

2026-07-12.13-16-31.mp4

How to Test

Manual/local verification

Verified locally.

Reviewer test steps

  1. Trigger any question with multiple: true
  2. Verify Space toggles the focused option and the footer shows space toggle and enter continue.
  3. Verify Enter advances to the next question tab (or to the Confirm tab on the last question), and that 1-9 still toggle the matching option.
  4. Verify single-select questions still submit immediately on Enter / digit, and Space does nothing.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

Discord: @IamCoder18

Comment thread packages/opencode/src/cli/cmd/run/footer.question.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/run/question.shared.ts
Comment thread packages/opencode/src/cli/cmd/tui/routes/session/question.tsx
Comment thread packages/opencode/src/cli/cmd/tui/routes/session/question.tsx
Comment thread packages/opencode/src/cli/cmd/tui/routes/session/question.tsx
@kilo-code-bot

kilo-code-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/cli/cmd/run/question.shared.ts 264 Space cannot reselect a saved custom answer
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 145 Enter can submit an empty answer when no option exists
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 334 Space cannot toggle a custom answer back on
Files Reviewed (5 files)
  • .changeset/fix-question-multiselect-space-toggle.md - 0 issues
  • packages/opencode/src/cli/cmd/run/footer.question.tsx - 0 issues
  • packages/opencode/src/cli/cmd/run/question.shared.ts - 1 issue
  • packages/opencode/src/cli/cmd/tui/routes/session/question.tsx - 2 issues
  • packages/opencode/test/cli/run/question.shared.test.ts - 0 issues
Previous Review Summaries (2 snapshots, latest commit 924fb36)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 924fb36)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/cli/cmd/run/question.shared.ts 264 Space cannot reselect a saved custom answer
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 145 Enter can submit an empty answer when no option exists
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 334 Space cannot toggle a custom answer back on
Files Reviewed (5 files)
  • .changeset/fix-question-multiselect-space-toggle.md - 0 issues
  • packages/opencode/src/cli/cmd/run/footer.question.tsx - 0 issues
  • packages/opencode/src/cli/cmd/run/question.shared.ts - 1 issue
  • packages/opencode/src/cli/cmd/tui/routes/session/question.tsx - 2 issues
  • packages/opencode/test/cli/run/question.shared.test.ts - 0 issues

Previous review (commit 422592b)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 1

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/cli/cmd/run/question.shared.ts 226 Enter reopens the custom multi-select editor instead of continuing
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 132 Enter cannot continue while the custom row is focused
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 281 The numbered shortcut for the custom row is now a no-op
packages/opencode/src/cli/cmd/tui/routes/session/question.tsx 311 Space bypasses the custom option in multi-select questions

SUGGESTION

File Line Issue
packages/opencode/src/cli/cmd/run/footer.question.tsx 69 Add a patch changeset for the user-facing keybinding change
Files Reviewed (4 files)
  • packages/opencode/src/cli/cmd/run/footer.question.tsx - 1 issue
  • packages/opencode/src/cli/cmd/run/question.shared.ts - 1 issue
  • packages/opencode/src/cli/cmd/tui/routes/session/question.tsx - 3 issues
  • packages/opencode/test/cli/run/question.shared.test.ts - 0 issues

Reviewed by gpt-5.6-sol-20260709 · Input: 62.5K · Output: 6.1K · Cached: 252.6K

Review guidance: REVIEW.md from base branch main

@IamCoder18
IamCoder18 force-pushed the fix/question-multiselect-space-toggle branch from 422592b to 924fb36 Compare July 12, 2026 19:53
Comment thread packages/opencode/src/cli/cmd/run/question.shared.ts Outdated
Comment thread packages/opencode/src/cli/cmd/tui/routes/session/question.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/tui/routes/session/question.tsx Outdated
In the kilo run footer and interactive TUI, multi-select questions used
Enter (and 1-9 digit shortcuts) to toggle options. This is inconsistent
with the convention used by other CLI TUIs (fzf, lazygit, btop, etc.)
where Space toggles and Enter confirms.

Realign the keybinds:

- Space now toggles the focused option in multi-select mode
- Enter now advances to the next question tab or the review/confirm tab,
  and submits on single-question single-select as before
- 1-9 digit shortcuts retain their previous "quick toggle" semantics
  in multi-select to avoid disrupting muscle memory
- Enter and Space on the custom "type your own" row now follow the same
  rules: Space toggles a typed value (regardless of whether it is
  currently selected, so you can re-select an untoggled value), or
  opens the editor when empty; Enter advances in multi-select (or
  opens the editor in single-select)
- Guard against picking an undefined option so Enter cannot submit an
  empty answer
- The footer hint line swaps "toggle" for "continue" on Enter and adds a
  "space toggle" hint when multi-select is active

Extract a pure questionToggleAction in question.shared.ts so the
footer can route Space and digit shortcuts through the same state
machine. Mirror the same split in the TUI QuestionPrompt with a new
continueOption() helper. Update the shared test to cover the new
advance semantics, the no-op behavior of toggle in single-select, the
custom-row interactions, and the toggle-off-then-on cycle.

Add a patch changeset for the user-facing keybind change.
@IamCoder18
IamCoder18 force-pushed the fix/question-multiselect-space-toggle branch from 924fb36 to 068aac7 Compare July 12, 2026 20:06
@IamCoder18

IamCoder18 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Fixed all issues

Kilo Code Review's comment didn't update (the inline review comments show Outdated correctly), but all issues have been fixed and verified. This is ready for review.

@marius-kilocode

Copy link
Copy Markdown
Collaborator

@IamCoder18 thanks, but this would introduce quite some conflicts. I don't think the value is worth the tradeoff. Do you agree?

@IamCoder18

Copy link
Copy Markdown
Contributor Author

@IamCoder18 thanks, but this would introduce quite some conflicts. I don't think the value is worth the tradeoff. Do you agree?

I agree.

@IamCoder18 IamCoder18 closed this Jul 14, 2026
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.

Multi-select question keybinds in kilo run and TUI don't match common CLI conventions

2 participants