Fix text positioning by calculating visual width without ANSI codes

The motion effects were appearing with incorrect row offsets because
the text width calculation included ANSI color escape sequences in
the byte length, causing misaligned centering.

Changes:
- Added utils/ansi.rs module with strip_ansi() and visual_width()
- Updated renderer to use visual_width() for offset positioning
- Updated TerminalManager::print_centered() to use visual_width()
- All text positioning now correctly ignores ANSI escape sequences

This fixes the "shifted in the rows" issue where colored text was
not properly centered due to escape sequence byte counts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 04:12:15 +01:00
parent 09665d3250
commit 24ca6f0262
4 changed files with 61 additions and 4 deletions

View File

@@ -1,2 +1,3 @@
pub mod ansi;
pub mod ascii;
pub mod terminal;