Skip to content

feat(terminal): add interactive arrow key navigation and scrolling to selection lists - #25

Merged
grobf5 merged 1 commit into
mainfrom
feat/interactive-arrow-selection-and-scrolling
Oct 9, 2026
Merged

grobf5 merged 1 commit into
mainfrom
feat/interactive-arrow-selection-and-scrolling

Conversation

@grobf5

@grobf5 grobf5 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements interactive arrow key selection and bounded viewport scrolling across the CLI's selection menus (MyF5 Software Downloads catalog browser and Support Case Wizard).

Key Features & Improvements

  • Arrow Key & Vim Navigation: Navigate list items using Up/Down arrows (\x1b[A, \x1b[B, \x1bOA, \x1bOB) as well as vim j / k keys.
  • Bounded Viewport Scrolling: Long lists (e.g. dozens of software releases, hotfix containers, or hundreds of ISO images) scroll smoothly within a bounded terminal viewport (default 10 items, dynamically capped to current terminal window height) with visual indicators:
    • ▲ (N more above)
    • ▼ (N more below)
  • Fast Navigation & Direct Jumps:
    • Page Up / Page Down (\x1b[5~, \x1b[6~): Jump by full page.
    • Home / End (\x1b[H, \x1b[F): Jump directly to the top or bottom of the list.
    • Direct Number Jumping: Press digit keys (1-9) to immediately jump to and highlight corresponding numbered items.
    • Live Keyword Filtering: Type / to start filtering items by search string in real time. Press Esc or clear the query to restore the full view.
    • Confirmation & Exit: Press Enter to confirm selection. Press b / Esc to navigate back, or q / Ctrl+C to quit.
  • Cursor Drift & Terminal Safety:
    • Automatically queries terminal dimensions via golang.org/x/term.
    • Hides cursor during menu interaction (\033[?25l) and guarantees cursor restoration on exit (\033[?25h).
    • Clamps string rendering length to terminal width (truncateRunes) to prevent unhandled terminal wrapping from miscalculating ANSI redraw cursor lines.
  • Non-TTY & CI Compatibility:
    • Seamlessly detects non-interactive TTYs (pipes, redirection, automated tests).
    • Automatically falls back to standard numbered prompts, ensuring existing test suites and batch pipelines continue to work without modification or hangs.

Scope of Changes

  1. cmd/myf5/selector.go:
    • Core interactive menu engine: SelectMenu, SelectConfig, SelectItem, runInteractiveLoop, readKey, and selectFallback.
    • Wizard helper: selectNavField.
  2. cmd/myf5/selector_test.go:
    • Comprehensive unit test coverage for CSI/SS3 escape decoding, arrow navigation, viewport scrolling, live filtering, digit jumping, and fallback behaviors.
  3. cmd/myf5/wizard.go:
    • Step 1 (auto-detection mode selection), Step 3 (Case Priority, Reason for Contact), and review field edits (5 & 6) converted to interactive selectNavField.
  4. cmd/myf5/main.go:
    • Downloads interactive browser converted to SelectMenu for Product Families, Product Lines, Versions, Categories, Containers, and Files.

Verification

  • make all (fmt, vet, unit tests, build): PASS
  • go test -v -race ./cmd/myf5/...: PASS
  • go test -v ./internal_docs/oas/...: PASS
  • ./bin/myf5 doctor: PASS (Zero secret exposure, verified clean)

… selection lists

- Implement reusable SelectMenu component in cmd/myf5/selector.go with raw-mode TTY detection and non-TTY fallback
- Support Up/Down arrow keys, vim j/k keys, PageUp/PageDown, Home/End, direct number jumping, and Enter confirmation
- Implement bounded viewport scrolling with dynamic terminal height detection and ▲/▼ overflow indicators
- Prevent cursor drift during ANSI redraws via strict terminal width line clamping
- Support live keyword filtering ('/') and seamless back/quit navigation ('b', 'q', Esc, Ctrl+C)
- Integrate SelectMenu into downloads interactive catalog browser (family, line, version, category, container, file)
- Integrate SelectMenu into support case wizard (auto-detection, priority, reason for contact, review edits)
- Add comprehensive unit test coverage in cmd/myf5/selector_test.go
@grobf5
grobf5 merged commit cac7079 into main Oct 9, 2026
12 checks passed
@grobf5
grobf5 deleted the feat/interactive-arrow-selection-and-scrolling branch October 9, 2026 20:13
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