Phase 4: Integrate syntax highlighting into code frame rendering
Added complete syntax highlighting integration:
Highlighting Architecture:
- Extract highlights once at the start of render_code_frame()
- Apply highlights "late" after line truncation to avoid column offset issues
- adjust_highlights_for_truncation() handles truncated views correctly
- Markers are filtered and adjusted for the visible range
ANSI Stripping:
- Added strip_ansi_codes() utility for testing
- Strips escape sequences while preserving text content
Testing:
- Added test_highlighting_doesnt_break_formatting() integration test
- Verifies highlighting with use_colors=false produces identical output
- Verifies ANSI-stripped output matches plain output
- Ensures highlighting doesn't mess up basic formatting
Additional Tests:
- test_strip_ansi_codes: Verify ANSI stripping works
- test_strip_ansi_codes_preserves_plain_text: No-op on plain text
- test_adjust_highlights_for_truncation: Verify marker adjustment
All 29 tests pass. Highlighting is fully functional and doesn't
break any existing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>