Skip to content

Fix MultiSelect bulk selection and Paginator previous item navigation - #403

Merged
shibayan merged 1 commit into
masterfrom
fix/multiselect-bulk-selection
Sep 30, 2026
Merged

shibayan merged 1 commit into
masterfrom
fix/multiselect-bulk-selection

Conversation

@shibayan

Copy link
Copy Markdown
Owner

Summary

  • Ctrl+A / Ctrl+I ignored Maximum: bulk selection could exceed the configured maximum. Both now compute the new selection first and show the maximum-selection error (leaving the selection unchanged) if it would exceed Maximum.
  • Ctrl+A / Ctrl+I behaved incorrectly while filtering:
    • Ctrl+A compared the total selected count against the filtered item count, so it could clear all selections (including hidden ones) or fail to toggle off.
    • Ctrl+I cleared selections that were hidden by the filter.
    • Both now operate only on the currently filtered items and preserve selections outside the filter. Without a filter the behavior is unchanged.
  • Up arrow with nothing selected jumped to the previous page (when LoopingSelection is false, e.g. after moving pages with ←/→). It now selects the last item on the current page, mirroring how Down selects the first item.

Tests

  • Added form interaction tests for Ctrl+A / Ctrl+I (select all, deselect all, filtered, maximum) and Paginator tests for PreviousItem.
  • 5 of the new tests fail on master and pass with this change; the full suite (690 tests, net8.0 / net10.0) passes.

🤖 Generated with Claude Code

- Ctrl+A and Ctrl+I now respect the Maximum option and show an error
  instead of exceeding it
- Ctrl+A and Ctrl+I only affect the currently filtered items, so
  selections hidden by the filter are preserved
- Pressing Up with nothing selected now selects the last item on the
  current page instead of jumping to the previous page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 04:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation matches the described behavior and includes focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes bulk selection under filtering/maximum constraints and corrects upward navigation without an active selection.

Changes:

  • Applies Ctrl+A/Ctrl+I only to filtered items while preserving hidden selections.
  • Enforces Maximum before committing bulk selection changes.
  • Keeps PreviousItem on the current page when nothing is selected.
File Description
src/​Sharprompt/​Forms/​MultiSelectForm.cs Corrects bulk-selection behavior and maximum enforcement.
src/​Sharprompt/​Internal/​Paginator.cs Corrects previous-item navigation without a selection.
tests/​Sharprompt.Tests/​Forms/​FormInteractionTests.cs Covers bulk selection, filtering, and maximum constraints.
tests/​Sharprompt.Tests/​Internal/​PaginatorTests.cs Covers previous-item page behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@shibayan
shibayan merged commit 57c5a15 into master Sep 30, 2026
6 checks passed
@shibayan
shibayan deleted the fix/multiselect-bulk-selection branch September 30, 2026 04:53
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.

2 participants