Skip to content

[#20] Added Space and navigation key hints to checkbox widgets.#23

Merged
AlexSkrypnyk merged 2 commits into
mainfrom
feature/20-spacebar-hint
Jul 10, 2026
Merged

[#20] Added Space and navigation key hints to checkbox widgets.#23
AlexSkrypnyk merged 2 commits into
mainfrom
feature/20-spacebar-hint

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jul 10, 2026

Copy link
Copy Markdown
Member

Closes #20

Summary

Checkbox-style widgets gave no on-screen indication that Space toggles the highlighted option, so that binding was only discoverable through documentation or trial and error. MultiSelectWidget now renders its own themed key-hint line beneath the option list and reports rendersHint(): TRUE so the editor chrome no longer draws its generic footer hint on top of it. MultiSearchWidget inherits the same behavior since it extends MultiSelectWidget. Rendering the left/right glyphs used by the new hint required extending the theme contract with arrowLeft()/arrowRight().

Changes

  • Added MultiSelectWidget::hint(), appended to the option list in view(), rendering space select · ↑/↓ move · ←/→ none/all · ↵ accept · esc cancel through the theme's footer()/dot() helpers.
  • Overrode MultiSelectWidget::rendersHint() to return TRUE so DefaultTheme::renderEditor() skips its generic hint footer for this widget (and for MultiSearchWidget, which extends it).
  • Added arrowLeft()/arrowRight() to ThemeInterface, mirroring the existing arrowUp()/arrowDown() contract.
  • Implemented arrowLeft()/arrowRight() in DefaultTheme, returning / in Unicode mode and </> in ASCII mode.
  • Added/updated tests in MultiSelectWidgetTest, MultiSearchWidgetTest, and ThemeRenderTest covering the new hint line, its ASCII degradation, and the rendersHint() override.

Before / After

Before - generic footer only, Space's role is invisible:

┌──────────────────────────────────────┐
│ [x] Apple                            │
│ [ ] Banana                           │
│ [x] Cherry                           │
│                                       │
│ ↵ accept · esc cancel                │
└──────────────────────────────────────┘

After - self-rendered hint, Space leads since it is the non-obvious action:

┌──────────────────────────────────────────────────────────────────┐
│ [x] Apple                                                         │
│ [ ] Banana                                                        │
│ [x] Cherry                                                        │
│                                                                    │
│ space select · ↑/↓ move · ←/→ none/all · ↵ accept · esc cancel   │
└──────────────────────────────────────────────────────────────────┘

Summary by CodeRabbit

  • New Features

    • Multi-select views now display a helpful keyboard shortcut hint for selecting, navigating, accepting, and cancelling.
    • Navigation hints use Unicode arrows when supported and ASCII alternatives otherwise.
    • Search-based multi-select views now inherit the same key-hint guidance.
  • Bug Fixes

    • Improved consistency of keyboard guidance across multi-select interfaces.

@AlexSkrypnyk AlexSkrypnyk added A2 Board worker 2 AUTOMERGE Worker auto-merges this PR once it is ready for review labels Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 515f2bdc-26b2-46ea-ae9a-4bfb475d0e21

📥 Commits

Reviewing files that changed from the base of the PR and between 873afc4 and 1d9231b.

📒 Files selected for processing (6)
  • src/Theme/DefaultTheme.php
  • src/Theme/ThemeInterface.php
  • src/Widget/MultiSelectWidget.php
  • tests/phpunit/Unit/Theme/ThemeRenderTest.php
  • tests/phpunit/Unit/Widget/MultiSearchWidgetTest.php
  • tests/phpunit/Unit/Widget/MultiSelectWidgetTest.php

📝 Walkthrough

Walkthrough

Adds themed left/right arrow helpers and renders a key-binding hint beneath multi-select options, with Unicode and ASCII fallback coverage.

Changes

Multi-select hint rendering

Layer / File(s) Summary
Theme arrow glyph contract and implementation
src/Theme/ThemeInterface.php, src/Theme/DefaultTheme.php, tests/phpunit/Unit/Theme/ThemeRenderTest.php
Adds arrowLeft() and arrowRight() to the theme API, with Unicode and ASCII implementations and tests.
Multi-select hint rendering
src/Widget/MultiSelectWidget.php, tests/phpunit/Unit/Widget/*
Adds the themed footer, exposes rendersHint(), and tests Unicode fallback, key hints, and inherited rendering behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant MultiSelectWidget
  participant ThemeInterface
  participant DefaultTheme
  MultiSelectWidget->>ThemeInterface: request key-binding glyphs
  ThemeInterface->>DefaultTheme: resolve arrowLeft() and arrowRight()
  DefaultTheme-->>MultiSelectWidget: return Unicode or ASCII glyphs
  MultiSelectWidget-->>MultiSelectWidget: append themed hint footer to view
Loading

Possibly related PRs

  • drevops/tui#21: Related theme API and widget view-rendering changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding key hints to checkbox widgets.
Linked Issues check ✅ Passed The PR adds the requested Spacebar selection hint and related checkbox widget guidance, satisfying issue #20.
Out of Scope Changes check ✅ Passed The added theme glyph support and tests directly support the checkbox hint feature and stay within scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/20-spacebar-hint

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.

🔧 PHPStan (2.2.2)

Composer install failed: the lock file is not up to date with the latest changes in composer.json. Run composer update and commit the updated composer.lock.


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

@github-actions

Copy link
Copy Markdown
Code Coverage Report:
  2026-07-10 09:04:55

 Summary:
  Classes: 89.29% (50/56)
  Methods: 96.80% (333/344)
  Lines:   98.89% (1334/1349)

DrevOps\Tui\Answers\Answer
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Answers\Answers
  Methods: 100.00% ( 9/ 9)   Lines: 100.00% ( 20/ 20)
DrevOps\Tui\Answers\SummaryFormatter
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 20/ 20)
DrevOps\Tui\Builder\FieldBuilder
  Methods:  85.71% (12/14)   Lines:  91.11% ( 41/ 45)
DrevOps\Tui\Builder\Form
  Methods: 100.00% (13/13)   Lines: 100.00% ( 49/ 49)
DrevOps\Tui\Builder\PanelBuilder
  Methods: 100.00% (16/16)   Lines: 100.00% ( 28/ 28)
DrevOps\Tui\Condition\CompositeCondition
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 19/ 19)
DrevOps\Tui\Condition\Condition
  Methods: 100.00% (10/10)   Lines: 100.00% ( 38/ 38)
DrevOps\Tui\Config\Config
  Methods: 100.00% ( 5/ 5)   Lines: 100.00% ( 17/ 17)
DrevOps\Tui\Config\Field
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
DrevOps\Tui\Config\Option
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Config\Panel
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Derive\Derive
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 14/ 14)
DrevOps\Tui\Derive\Deriver
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% ( 13/ 13)
DrevOps\Tui\Derive\Transform
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  7/  7)
DrevOps\Tui\Discovery\AbstractDiscover
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Discovery\Dotenv
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 19/ 19)
DrevOps\Tui\Discovery\JsonValue
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 16/ 16)
DrevOps\Tui\Discovery\PathExists
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  3/  3)
DrevOps\Tui\Discovery\Scan
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 20/ 20)
DrevOps\Tui\Engine\Engine
  Methods: 100.00% (12/12)   Lines: 100.00% ( 89/ 89)
DrevOps\Tui\Handler\HandlerRegistry
  Methods:  85.71% ( 6/ 7)   Lines:  95.45% ( 21/ 22)
DrevOps\Tui\Input\ArrayKeyStream
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 12/ 12)
DrevOps\Tui\Input\Key
  Methods: 100.00% ( 5/ 5)   Lines: 100.00% (  5/  5)
DrevOps\Tui\Input\KeyParser
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% ( 68/ 68)
DrevOps\Tui\Render\Ansi
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% (  5/  5)
DrevOps\Tui\Render\Box
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 15/ 15)
DrevOps\Tui\Render\Navigator
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% ( 15/ 15)
DrevOps\Tui\Render\PanelController
  Methods: 100.00% (16/16)   Lines: 100.00% ( 87/ 87)
DrevOps\Tui\Render\Scroller
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 12/ 12)
DrevOps\Tui\Render\Terminal
  Methods: 100.00% (12/12)   Lines: 100.00% ( 35/ 35)
DrevOps\Tui\Render\TerminalControl
  Methods: 100.00% ( 9/ 9)   Lines: 100.00% (  9/  9)
DrevOps\Tui\Render\Viewport
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Resolver\InputResolver
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% ( 27/ 27)
DrevOps\Tui\Schema\AgentHelp
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 16/ 16)
DrevOps\Tui\Schema\SchemaGenerator
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 25/ 25)
DrevOps\Tui\Schema\SchemaValidator
  Methods: 100.00% ( 7/ 7)   Lines: 100.00% ( 40/ 40)
DrevOps\Tui\Theme\DefaultTheme
  Methods:  91.80% (56/61)   Lines:  96.77% (180/186)
DrevOps\Tui\Theme\ThemeManager
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  8/  8)
DrevOps\Tui\Tui
  Methods: 100.00% (12/12)   Lines: 100.00% ( 26/ 26)
DrevOps\Tui\Widget\AbstractWidget
  Methods: 100.00% (10/10)   Lines: 100.00% ( 20/ 20)
DrevOps\Tui\Widget\ConfirmWidget
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% ( 23/ 23)
DrevOps\Tui\Widget\MultiSearchWidget
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)
DrevOps\Tui\Widget\MultiSelectWidget
  Methods: 100.00% ( 9/ 9)   Lines: 100.00% ( 64/ 64)
DrevOps\Tui\Widget\NumberWidget
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  7/  7)
DrevOps\Tui\Widget\PasswordWidget
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  3/  3)
DrevOps\Tui\Widget\PauseWidget
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  6/  6)
DrevOps\Tui\Widget\SearchWidget
  Methods:  80.00% ( 4/ 5)   Lines:  94.59% ( 35/ 37)
DrevOps\Tui\Widget\SelectWidget
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 19/ 19)
DrevOps\Tui\Widget\SuggestWidget
  Methods: 100.00% ( 5/ 5)   Lines: 100.00% ( 37/ 37)
DrevOps\Tui\Widget\TextWidget
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% ( 29/ 29)
DrevOps\Tui\Widget\TextareaWidget
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 34/ 34)
DrevOps\Tui\Widget\WidgetFactory
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 25/ 25)
DrevOps\Tui\Widget\WidgetRunner
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  5/  5)

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.88%. Comparing base (873afc4) to head (1d9231b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #23   +/-   ##
=======================================
  Coverage   98.87%   98.88%           
=======================================
  Files          56       56           
  Lines        1337     1349   +12     
=======================================
+ Hits         1322     1334   +12     
  Misses         15       15           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@AlexSkrypnyk AlexSkrypnyk merged commit 637d2e6 into main Jul 10, 2026
9 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/20-spacebar-hint branch July 10, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A2 Board worker 2 AUTOMERGE Worker auto-merges this PR once it is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checkboxes items needs to have a hint to use Spacebar to select

1 participant