Add Cmd+Backspace delete line and resize crash tests
Done! Here's a summary of the changes:
New Feature: Delete Line (Cmd+Backspace)
- Added
DeleteLinemessage toDocumentMsgin src/messages.rs - Implemented delete line logic in src/update.rs with proper handling for:
- First, middle, and last lines
- Lines with/without trailing newlines
- Empty lines
- Cursor position adjustment after deletion
- Undo support
- Added keybinding in src/main.rs
- Added 8 tests in tests/text_editing.rs
Expanded Monkey Tests
Added 12 new window resize edge case tests in tests/monkey_tests.rs:
test_resize_to_maximum_u32test_resize_very_wide_narrow/test_resize_very_tall_narrowtest_resize_then_cursor_movementtest_resize_then_scrollingtest_resize_oscillating_zero_nonzerotest_resize_with_selection_activetest_resize_with_cursor_beyond_viewporttest_resize_powers_of_twotest_resize_with_text_operationstest_resize_status_bar_edge
Fixed Overflow Bugs (found by the new monkey tests)
- src/update.rs: Used
saturating_add/saturating_subforbottom_boundarycalculation - src/model/editor.rs: Used
saturating_subfor horizontal scroll calculations - src/model/status_bar.rs: Used
saturating_subfor separator positioning
All 246 tests pass.
All tests pass. Updated documentation:
docs/CHANGELOG.md: Added new section for today's work including delete line, duplicate, atomic replace, undo/redo fix, overflow fixes, expanded monkey tests, and status bar click capture
CLAUDE.md: Added Duplicate (Cmd+D) and Delete line (Cmd+Backspace) to the Editing keybindings table
docs/ROADMAP.md: Updated test counts (text_editing: 38, monkey_tests: 34, total: 246)
Phase 1 is complete. Here's what was implemented:
Phase 1: Core Data Structures ✅
Created src/model/editor_area.rs with:
- ID types:
DocumentId,EditorId,GroupId,TabId- unique identifiers for all entities - Layout primitives:
Rectwithcontains()for hit testing - Tab system:
Tabstruct withis_pinnedandis_previewflags - Editor groups:
EditorGroupwith tabs andactive_tab_index - Layout tree:
LayoutNodeenum (Group or Split),SplitContainerwith direction and ratios - EditorArea: Top-level container with HashMaps for documents/editors/groups, layout tree, and focus tracking
- Migration helper:
EditorArea::single_document()for backward compatibility
Updated existing types:
- src/model/document.rs: Added
id: Option<DocumentId>field - src/model/editor.rs: Added
id: Option<EditorId>anddocument_id: Option<DocumentId>fields - src/model/mod.rs: Exported all new types
All 246 tests pass. The foundation is in place for Phase 2 (Layout System) which will add compute_layout() and splitter drag handling.
Now let me add the layout computation methods. I'll add them after the existing EditorArea implementation:
Now update the exports in mod.rs:
Now add unit tests for the layout system:
All 7 editor_area tests pass. Now let me update the ROADMAP.md:
Now update the test counts in the module structure:
All 253 tests pass (24 lib + 14 main + 215 integration = 253). Let me verify the build works too:
Phase 1 & 2 Complete!
Summary of Split View Implementation Progress
Phase 1: Core Data Structures ✅
- Created src/model/editor_area.rs with:
- ID types:
DocumentId,EditorId,GroupId,TabId Rectfor layout calculations withcontains()hit testingTabstruct withis_pinnedandis_previewflagsEditorGroupwith tabs andactive_tab_indexLayoutNodeenum (Group or Split) andSplitContainerEditorArea- top-level container with HashMaps and layout treesingle_document()migration helper for backward compatibility
- ID types:
- Updated
DocumentandEditorStatewith optional ID fields
Phase 2: Layout System ✅
compute_layout()- recursively computes rects for all groups based on split ratiosgroup_at_point()- finds which group contains a given (x, y) coordinatesplitter_at_point()- hit testing for splitter barsSplitterBarstruct with direction, rect, and indexSPLITTER_WIDTHconstant (6px)- 7 unit tests for layout computation
Test count: 253 (24 lib + 14 main + 215 integration)
Next Steps (Phase 3+):
- Phase 3: Replace
model.document/model.editorwithmodel.editor_areain AppModel - Phase 4: Add
LayoutMsgfor split/close/focus operations - Phase 5: Multi-group rendering with tab bars and splitters
- Phase 6: Document synchronization across views
- Phase 7: Keyboard shortcuts (Cmd+, Cmd+W, etc.)