Expand description
List component with filtering, pagination, contextual help, and customizable rendering.
This module exposes a generic Model<I: Item> plus supporting traits and submodules:
Item: Implement for your item type; must beDisplay + Cloneand return afilter_value()ItemDelegate: Controls itemrender,height,spacing, andupdate- Submodules:
defaultitem,keys, andstyle
§MAJOR BUG FIXES - Viewport Scrolling & Filter Input (v0.1.4+)
This implementation includes comprehensive fixes for critical list component issues:
§🔧 Fixed Issues
- Filter Input Accumulation: Characters now accumulate correctly during typing
- Cursor Highlighting Loss: Selection indicator persists during viewport scrolling
- Viewport Page Jumping: Smooth one-item-at-a-time scrolling instead of jarring page jumps
- Upward Scrolling Problems: Proper viewport adjustment when scrolling up
§🏗️ Architecture Changes
- Smooth Viewport Scrolling:
viewport_startfield +sync_viewport_with_cursor()method - Proper Index Handling: Original item indices for cursor highlighting, viewport-relative for display
- Enhanced Filter Input: Direct textinput component integration instead of manual string manipulation
- State Management: Improved filtering state transitions to prevent input blocking
§📋 Key Design Decisions
- Index Semantics: Render delegates receive original item indices for consistent cursor highlighting
- Viewport Strategy: Only scroll when cursor moves outside visible bounds (context preservation)
- Filter Integration: Maintain
Filteringstate during typing, only change toFilterAppliedon Enter - Event Forwarding: Proper KeyMsg creation and forwarding to textinput component
§Filtering States
The list supports fuzzy filtering with three states:
Unfiltered: No filter activeFiltering: User is typing a filter; input is shown in the headerFilterApplied: Filter accepted; only matching items are displayed
When filtering is active, fuzzy match indices are stored per item and delegates can use
them to apply character-level highlighting (see defaultitem).
§Help Integration
The list implements help::KeyMap, so you can embed help::Model and get contextual
help automatically based on the current filtering state.
Re-exports§
pub use defaultitem::DefaultDelegate;pub use defaultitem::DefaultItem;pub use defaultitem::DefaultItemStyles;pub use keys::ListKeyMap;pub use style::ListStyles;
Modules§
- defaultitem
- Default item implementation and delegate for list components.
- keys
- Key bindings for list component navigation and interaction.
- style
- Styling system for list components.
Structs§
- Model
- List model containing items, filtering, pagination, and styling.
Enums§
- Filter
State - Current filtering state of the list.
Traits§
- Item
- An item that can be displayed in the list.
- Item
Delegate - A delegate encapsulates the functionality for a list item.