109bdc8dc3
Bookmarks now track the correct line number across insert/delete
edits (MC parity). Previously a bookmark at line 5 would still
report line 5 even after lines 1-3 were deleted, pointing at
wrong content.
BookmarkSet (editor/bookmark.rs):
New method adjust_lines(at_line: u32, delta: i32)
- For each mark with line > at_line: shift by delta
- For positive delta: mark.line += delta
- For negative delta with mark.line in deletion range:
clamp to at_line + 1 (first surviving line after range)
- Column is preserved across all shifts
- Zero delta is a no-op (no allocation)
Editor (editor/mod.rs):
New private helper adjust_bookmarks_after_edit(edit_line, lines_before)
Wraps insert_char, insert_str, delete_back, delete_forward:
- Captures (line_before, lines_before) before buffer op
- Calls buffer op
- Computes delta = lines_after - lines_before
- Calls bookmarks.adjust_lines(line_before, delta) if non-zero
Tests (6 new in editor::bookmark::tests):
- adjust_lines_zero_delta_is_noop
- adjust_lines_shifts_marks_after_insertion
- adjust_lines_shifts_marks_after_deletion
- adjust_lines_multi_line_insertion
- adjust_lines_deletion_clamps_to_anchor
- adjust_lines_does_not_touch_col
Total: 1259 passing (was 1253; +6 new).