Files
bun.sh/test/js
Claude Bot e3adf88615 fix(bun): handle malformed ANSI sequences in Bun.stringWidth
Fixed a bug where Bun.stringWidth() returned 0 for strings containing
malformed ANSI escape sequences (e.g., "\x1b[" without closing "m").

The issue was in two places:
1. visibleLatin1WidthExcludeANSIColors: When no closing 'm' was found after
   '\x1b[', the function returned early without counting remaining characters
2. visibleUTF16WidthFn: Similar issue with unclosed sequences

Now treats malformed ANSI sequences as literal text and counts their visible
width correctly.

Added comprehensive tests for edge cases including:
- Unclosed ANSI sequences
- Binary data with control characters
- Multiple malformed sequences

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 23:58:53 +00:00
..
2024-12-12 02:07:29 -08:00
2025-10-27 18:58:06 -07:00