Skip to content

navigation with arrow keys for slash commands with highlighting#578

Open
rakshith1928 wants to merge 2 commits into
Nano-Collective:mainfrom
rakshith1928:feature/command-completion-navigation-v2
Open

navigation with arrow keys for slash commands with highlighting#578
rakshith1928 wants to merge 2 commits into
Nano-Collective:mainfrom
rakshith1928:feature/command-completion-navigation-v2

Conversation

@rakshith1928

@rakshith1928 rakshith1928 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Add keyboard navigation (up/down arrows) and Enter selection to the slash command completion menu, matching modern CLI UX .
Closes #575 (maybe create a new issue for mouse click feature in future)

Changes:

  • Type / → completions appear with first item auto-selected (▸ /command)
  • / → navigate completions
  • Enter → selects highlighted command → fills /command in input, clears placeholders
  • Tab → no-op when completions visible (This avoids conflict with file autocomplete (which uses Tab to select))->Use Enter to select
  • Esc → clears input, hides completions, resets selection

Also The Completion type is defined in source/types/components.ts (line 18), not in types/index.ts. The original code had a wrong import that would fail type-checking.

Files changed:

  • source/hooks/useUIState.ts - added selectedCompletionIndex state
  • source/components/user-input.tsx - navigation, selection, highlighting( selectedCommad uses colors.info others use colors.primary)
  • source/hooks/useUIState.spec.ts - new state tests
  • source/components/user-input.spec.tsx - render tests

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Demo Video

Screen.Recording.2026-06-17.035138.mp4

Future upgarde maybe adding mouse click option .
Check issue #575

Testing

pnpm test:format
pnpm test:types
pnpm test:lint
pnpm test:ava
pnpm test:knip
pnpm test:audit
source/hooks/useUIState.spec.ts - new state tests
source/components/user-input.spec.tsx - render tests

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

@rakshith1928 rakshith1928 changed the title navigation with arrow keys for slash commands navigation with arrow keys for slash commands with highlighting Jun 17, 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.

[Feature] Navigable Slash Commands (Arrow Keys + Enter Selection)

1 participant