Skip to content

Conversation

@nightscape
Copy link

Description

Implements a reusable, interactive list widget component that provides:

  • Multi-item selection with visual indicators
  • Keyboard-driven navigation and batch operations
  • Trait-based customization for domain-specific items
  • TodoList demo application showcasing all features

This PR adds foundational Phase 1 support with fixed-height items. Future work will add Phase 2 (variable-height items
with dynamic layout).

Checklist

What Changed

Core Implementation (tui/src/tui/list/) - ~1,850 lines

Architecture:

  • list_item_trait.rs - ListItem<S, AS> trait for custom item rendering/events
  • list_component_struct.rs - Component state (cursor, selection, viewport, batch actions)
  • list_component_impl.rs - Navigation logic and event routing
  • test_list_component.rs - Comprehensive unit tests

Key Features:

  1. Navigation - Arrow keys, PageUp/PageDown, Home/End with viewport scrolling
  2. Multi-select - Space bar selection with selected_ids tracking
  3. Batch Actions - Custom key bindings for bulk operations on selected items
  4. Type Safety - ListItemId wrapper prevents index/ID confusion

Demo Application (tui/examples/tui_apps/ex_list_component/)

TodoList example demonstrates:

  • Custom ListItem implementation with priority levels and completion status
  • Batch actions: Delete (d), Complete (c), Set High Priority (h)
  • Per-item actions: Toggle completion (t), Cycle priority (p)
  • Full TUI layout with help text and status messages

How to Test

cargo run --example tui_apps
# Select option 4: "ListComponent demo (TodoList...)"

Keybindings:

  • ↑/↓ - Navigate items
  • Space - Toggle selection
  • t - Toggle item completion
  • p - Cycle item priority
  • d - Delete selected (batch)
  • c - Complete selected (batch)
  • h - Set high priority (batch)
  • q - Quit

Files Changed

  • 12 files, 1,859 insertions
  • New module: tui/src/tui/list/ (4 files)
  • New example: tui/examples/tui_apps/ex_list_component/ (4 files)
  • Updated: tui/examples/tui_apps/main.rs (menu integration)

- step 8 of docs/task_remove_crossterm.md
- Reorganize the entire src/core/ansi/ module for semantic clarity
- Clean structure of tui/src/tui/terminal_lib_backends/direct_to_ansi/
- Formalize mod.rs standards in CLAUDE.md
      ╱╲
     ╱  ╲  Integration (generated) - System testing
    ╱────╲
   ╱      ╲  Unit (generated) - Component testing
  ╱────────╲
 ╱          ╲  Validation (hardcoded) - Acceptance testing
╱────────────╲

| Level       | Purpose                        | Sequences | Why                                     |
|-------------|--------------------------------|-----------|-----------------------------------------|
| Validation  | Spec compliance & Ground truth | Hardcoded | Independent reference (VT-100 protocol) |
| Unit        | Component contracts            | Generated | Round-trip (generator ↔ parser)         |
| Integration | System behavior                | Generated | Real-world usage pattern                |

The `test_fixtures` module is shared between the unit, and integration tests only.
Complete Step 8.2.1 -> Phase 7.1.1
…ants

Execution of plan in: docs/task_refactor_input_device.md
✅ Custom Slash Command /task

Location: .claude/commands/task.md

Valid operations (referenced as $1 argument):
- create - Creates a new task file from your planning/todo list
- update - Updates progress status in an existing task file
- load - Loads an existing task file and resumes work

Expected task file format (referenced as $2 argument):
- Creates/loads files at ./task/$2.md

✅ Task File Rules task/CLAUDE.md

Location: task/CLAUDE.md

Enforces proper structure:
[doctoc auto-generated TOC]

Valid status codes:
- [COMPLETE]
- [WORK_IN_PROGRESS]
- [BLOCKED]
- [DEFERRED]

Formatting requirements:
- Use doctoc to auto-generate table of contents
- Use prettier for markdown formatting

The system is properly configured and ready to use. Both the slash
command and the task file template follow the documented conventions for
managing long-running tasks in this project.
…sk/ folder structure

Separate the concerns by moving task workflow management files from the
documentation folder to a dedicated task management structure:

**File Migration Summary:**
- Moved 15 completed tasks to `task/done/`
- Moved 4 active tasks to `task/`
- Moved 10 future tasks to `task/pending/`
- Total: 30 task files reorganized

**Folder Structure:**
- `task/` - Currently active tasks being worked on
- `task/done/` - Completed tasks with historical context
- `task/pending/` - Tasks planned for future work
- `task/archive/` - Historical/archived tasks (for future use)

**References Updated:**
- Updated 18 task file references in `todo.md` to reflect new paths
- Updated 8 task file references in `done.md` to reflect new paths
- Updated configuration in `.claude/commands/task.md` and `CLAUDE.md`

**Preservation:**
- Used `git mv` for all file moves to preserve complete commit history
- All markdown links and references remain functional

This reorganization aligns with the project's separation of concerns principle:
- `docs/` folder: Documentation and guides
- `task/` folder: Workflow management and task tracking
…rd for single file task management

This commit restructures all the files in task/* to follow CLAUDE.md task
management standards, ensuring consistency with the project's task documentation
guidelines
…nversions from IR types

- Refactor the InputDevice entirely and separate direct_to_ansi, mock,
  and crossterm support.
- Use terminal_io/InputEvent, etc. where ever possible in the codebase.
- VT100 parsing needs IR types to impl the parsing logic. Provide a
  clean conversion route to the canonical types from the parser.

Tracking task: task/task_refactor_input_device.md
word_boundaries:
- Add tui/src/core/graphemes/word_boundaries mod
- Reusable word boundary checking functions
- Can be used in editor as well as readline_async

readline_async:
- Add keybindings to readline_async:
  - Ctrl+D on empty line (exits)
  - Ctrl+D on non-empty line (deletes char)
  - Ctrl+W with "hello world" → "hello "
  - Ctrl+W with "hello-world" → "hello-"
  - Ctrl+Left with "hello-world|" → "hello-|world"
  - Ctrl+Right with "|hello-world" → "hello-|world"
  - Alt+B backward word
  - Alt+F forward word
  - Alt+D word deletion
  - Alt+Backspace word deletion
  - Edge cases: beginning/end of
  - Unicode: emoji, multi-byte chars
- Add comprehensive unit tests
- Add PTY isolated integration tests (that spawns the test in a pty
  slave and the pty master sends byte sequences for end to end testing)
terminal_raw_mode mod:
- Fix terminal_raw_mode enable / disable raw mode fns
- Add robust integration_tests to ensure the code works

readline_async mod:
- Fix bugs
- Add missing features
- Add comprehensive integration tests

core/ansi/vt_100_terminal_input_parser/keyboard.rs:
- Fix bugs
- Add missing features (critical shortcut support)
- Add comprehensive integration tests

word_boundaries mod:
- Add missing features

task/task_readline_async_add_shortcuts.md:
- Create task to add more shortcuts to readline_async for feature parity with readline

WIP
core/ansi/vt_100_terminal_input_parser/ mod:
- Remove magic strings and use constants
- Don't use match statements w/ constants and use if statement instead
- Fix clippy lints
@nazmulidris nazmulidris force-pushed the main branch 24 times, most recently from 787028e to 96c11e3 Compare December 7, 2025 20:44
@nazmulidris nazmulidris force-pushed the main branch 6 times, most recently from 8eeef51 to 5be7c66 Compare December 9, 2025 20:14
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