fix(tui): isImageLine should detect image escape sequences anywhere in line

Changed isImageLine() from using startsWith() to includes() to detect
Kitty and iTerm2 image escape sequences anywhere in a line, not just
at the start. This prevents TUI width checks from failing on lines
containing image data, which could cause crashes when rendering tool
results with images (e.g., when reading image files).

Also added comprehensive test coverage for isImageLine() including:
- Both iTerm2 and Kitty protocols
- Regression tests for long lines and terminals without image support
- Negative cases to ensure no false positives

Fixes crash: 'Rendered line exceeds terminal width' when image
escape sequences appear in output.
This commit is contained in:
Dave dV 2026-01-30 10:07:22 +00:00
parent 2cee7e17de
commit 2339d7b5ac
3 changed files with 160 additions and 15 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed `isImageLine()` to check for image escape sequences anywhere in a line, not just at the start. This prevents TUI width checks from failing on lines containing image data, which could cause crashes when rendering tool results with images.
## [0.50.4] - 2026-01-30
### Added