Multi-cursor select navigation implementation review
Here's the summary of what was done:
Summary
Multi-Cursor Movement Gap Identified
Root cause: All movement handlers use cursor_mut() which always returns &mut cursors[0] (primary cursor only). Multi-cursor editing works (insert/delete), but movement doesn't.
Created Implementation Plan
feature/MULTI_CURSOR_MOVEMENT.md with 5 phases:
| Phase | Description | Effort |
|---|---|---|
| 0 | Per-cursor primitives (move_cursor_*_at(idx)) |
Low |
| 1 | All-cursors wrappers (move_all_cursors_*()) |
Low |
| 2 | Update movement handlers in update.rs | Medium |
| 3 | Selection movement helpers (*_with_selection) |
Low |
| 4 | Update Shift+Arrow handlers | Low |
| 5 | Per-line whitespace helpers | Low |
Total effort: ~1-3 hours
Docs Cleaned Up
- ROADMAP.md: Reorganized with "In Progress" section for multi-cursor movement, removed verbose completed items
- CHANGELOG.md: Added entry documenting the identified gap and plan
Key Implementation Points
- Add index-based helpers to
EditorState:move_cursor_left_at(doc, idx) - Add all-cursors wrappers:
move_all_cursors_left(doc)that iterate + deduplicate - Update each
MoveCursor*handler to use new methods - Add selection variants for Shift+movement
- Every multi-cursor operation ends with
deduplicate_cursors()
Summary
Multi-cursor movement is now fully implemented:
Changes Made
src/model/editor.rs - Added ~400 lines:
- Per-cursor primitives:
move_cursor_left_at(),move_cursor_right_at(),move_cursor_up_at(),move_cursor_down_at(),move_cursor_line_start_at(),move_cursor_line_end_at(),move_cursor_document_start_at(),move_cursor_document_end_at(),move_cursor_word_left_at(),move_cursor_word_right_at(),page_up_at(),page_down_at() - All-cursors wrappers:
move_all_cursors_*()for each primitive - Selection variants:
move_all_cursors_*_with_selection()for Shift+movement
src/update.rs - Refactored handlers:
- All
MoveCursor*handlers now use new all-cursors methods - Removed ~125 lines of legacy single-cursor movement functions
- Cleaner code with scoped borrows
tests/cursor_movement.rs - 10 new tests:
test_multi_cursor_arrow_left_moves_alltest_multi_cursor_arrow_right_moves_alltest_multi_cursor_arrow_up_moves_alltest_multi_cursor_arrow_down_moves_alltest_multi_cursor_movement_deduplicates_on_collisiontest_multi_cursor_home_moves_alltest_multi_cursor_end_moves_alltest_multi_cursor_word_right_moves_alltest_multi_cursor_selection_extends_alltest_multi_cursor_vertical_preserves_desired_column
Test count: 383 total (was 351)
Here are the planned features in priority order:
| Feature | Complexity | Description |
|---|---|---|
| Expand/Shrink Selection | Small | Option+Up/Down to expand word→line→all, with history stack |
| File Dropping | Medium | Drag-and-drop files onto window to open them |
| Workspace Management | Large | CLI args (red file1 file2), file tree sidebar, FS watching |
| Codebase Organization | Medium | Split main.rs (update.rs ( |
| Undo Coalescing | Small | Group rapid keystrokes into single undo entries |
Deferred items (from Split View):
- Splitter drag resize
- Tab drag-and-drop between groups
- Cursor adjustment when other views edit same document
Which would you like to tackle next?
Found that Expand/Shrink Selection is already implemented! Let me verify it's complete and check the other items:
Expand/Shrink Selection is fully implemented! It has:
- Messages (
ExpandSelection,ShrinkSelection) - Handlers with selection history stack
- Keyboard bindings (Option+Up/Down)
Let me check if there are tests for it and then update the docs:
There are tests too! Let me count them:
Expand/Shrink Selection is fully implemented with 18 tests! Now let me update the ROADMAP and CHANGELOG:
Now let me update the CHANGELOG to add the Expand/Shrink Selection feature:
Now let me update the feature design doc to mark it as complete:
Now let me verify the build still works:
Summary
Updated docs to reflect that Expand/Shrink Selection was already implemented:
Features Already Complete (docs now updated)
| Feature | Tests | Keybindings |
|---|---|---|
| Expand/Shrink Selection | 18 tests | Option+Up/Down |
| Multi-Cursor Movement | 10 tests | Arrow keys, Home/End, etc. |
Still Planned
| Feature | Description |
|---|---|
| File Dropping | Drag-and-drop files onto window |
| Workspace Management | CLI args, file tree sidebar, FS watching |
| Codebase Organization | Split main.rs (3108 lines) and update.rs (2977 lines) |
| Undo Coalescing | Group rapid keystrokes into single undo |
Deferred (from Split View)
- Splitter drag resize
- Tab drag-and-drop
- Cursor adjustment when other views edit same document