### Buffer structure - [x] Create the `Buffer` struct - [x] Store file contents using `Vec<String>` - [x] Add cursor position tracking (`row` and `column`) - [x] Define cursor position invariants - [x] Prevent invalid cursor positions - [x] Handle empty lines correctly ### File loading - [x] Implement `fetch()` to load file contents - [x] Handle missing files - [x] Handle empty files - [x] Handle file reading errors - [x] Preserve trailing empty lines - [x] Support large files ### Buffer operations - [x] Implement line access helpers - [x] Implement character access helpers - [x] Implement line insertion - [x] Implement line deletion - [x] Implement character insertion - [x] Implement character deletion - [x] Implement buffer modification tracking ### Cursor management - [x] Implement cursor boundary validation - [x] Handle cursor movement across empty lines - [x] Handle cursor movement across different line lengths - [x] Handle UTF-8 text correctly - [x] Add cursor position tests ### Definition of Done - Buffer operations never access invalid indexes. - Empty buffers and empty lines are handled safely. - Cursor coordinates remain consistent after modifications. - Core operations are covered by unit tests.
Activity