Skip to content

fix: Search in help - #409

Open
yhay81 wants to merge 4 commits into
LargeModGames:mainfrom
yhay81:agent/issue-408
Open

fix: Search in help#409
yhay81 wants to merge 4 commits into
LargeModGames:mainfrom
yhay81:agent/issue-408

Conversation

@yhay81

@yhay81 yhay81 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #408.

Summary

Search in help

Validation

  • Mechanical gate: +178/-3, tests passed
  • Adversarial review: approved

🤖 AI-authored PR, operated by @yhay81.

Summary by CodeRabbit

  • New Features

    • Help-menu search now highlights matching text in key names, descriptions, and contexts.
    • Search supports smart-case matching, overlapping matches, and Unicode text.
    • Press Enter to apply a filter and Esc to clear it.
  • Documentation

    • Updated keybindings documentation with Help-menu search instructions.
    • Added an unreleased changelog entry describing search highlighting.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 15aea97d-b997-443c-8207-138d1f8dbbc3

📥 Commits

Reviewing files that changed from the base of the PR and between 3118f2d and a956279.

📒 Files selected for processing (2)
  • src/tui/ui/help.rs
  • src/tui/ui/popups.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tui/ui/popups.rs

📝 Walkthrough

Walkthrough

The Help menu now highlights every filter match in visible rows. Matching uses smart-case rules and Unicode-safe byte ranges. The app-level model stores match ranges before rendering. Documentation and tests cover the behavior.

Changes

Help search highlighting

Layer / File(s) Summary
Match range calculation and validation
src/tui/ui/help.rs
help_match_ranges finds smart-case matches, maps them to valid UTF-8 byte ranges, merges overlaps, and tests Unicode and boundary cases.
Cached Help-menu rendering
src/tui/ui/popups.rs
ensure_help_menu_model caches formatted rows and match ranges. Rendering applies highlight styling to matched spans and uses cached row counts. Tests cover filtered, inactive, and no-match states.
Help-menu render wiring and documentation
src/tui/runner.rs, src/tui/ui/mod.rs, docs/keybindings.md, CHANGELOG.md
The runner prepares the model before rendering. The UI module re-exports the preparation function. Documentation describes search, highlighting, Enter, and Esc. The changelog records the feature.

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

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HelpMenu
  participant ensure_help_menu_model
  participant Terminal
  User->>HelpMenu: enter a search filter
  HelpMenu->>ensure_help_menu_model: prepare formatted rows and match ranges
  ensure_help_menu_model->>Terminal: render matched and unmatched spans
  Terminal-->>User: display highlighted filter matches
Loading
🚥 Pre-merge checks | ✅ 4
✅ 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 uses the allowed fix: prefix and concisely describes the help search change.
Linked Issues check ✅ Passed The changes implement help search by key and description, with filtering and highlighting, addressing issue #408.
Out of Scope Changes check ✅ Passed The changelog, documentation, matching logic, rendering changes, caching, and tests all support the help search objective.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@src/tui/ui/help.rs`:
- Around line 46-68: Update help_match_ranges in both case-sensitive and
case-insensitive matching branches to detect overlapping term matches by
checking every valid UTF-8 character boundary instead of relying on
str::match_indices. Preserve the existing range widening for case-insensitive
matches, and add a regression assertion that help_match_ranges("aaa", "aa")
returns vec![(0, 3)].

In `@src/tui/ui/popups.rs`:
- Around line 29-30: Remove the global HELP_MENU_CACHE and move the formatted
help model into App-owned state. Update draw_help_menu to receive immutable help
data from App rather than locking or mutating cache state during rendering, and
rebuild that data only when input or resize state changes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fce0cab1-1ff7-4b59-8da4-fe97a9b4450f

📥 Commits

Reviewing files that changed from the base of the PR and between 7b87065 and 4a2d3a3.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • docs/keybindings.md
  • src/tui/ui/help.rs
  • src/tui/ui/popups.rs

Comment thread src/tui/ui/help.rs
Comment thread src/tui/ui/popups.rs Outdated
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.

Search in help

1 participant