Skip to content

Fix sticky zone width calculations for ANSI content#136

Merged
shellicar merged 2 commits intomainfrom
fix/sticky-zone-width-math
Mar 28, 2026
Merged

Fix sticky zone width calculations for ANSI content#136
shellicar merged 2 commits intomainfrom
fix/sticky-zone-width-math

Conversation

@shellicar
Copy link
Copy Markdown
Owner

Summary

  • Introduce stripAnsiLength utility to measure visible character width
  • Fix cursor row wrap count ignoring ANSI codes in prompt prefix
  • Fix missing self-wrap contribution for the cursor's own line
  • Fix stickyLineCount and cursorLinesFromBottom inflated by ANSI codes

Related Issues

Closes #133


Co-Authored-By: Claude noreply@anthropic.com

@shellicar shellicar added this to the 1.0 milestone Mar 28, 2026
@shellicar shellicar added the bug Something isn't working label Mar 28, 2026
@shellicar shellicar self-assigned this Mar 28, 2026
@shellicar shellicar enabled auto-merge (squash) March 28, 2026 09:30
@shellicar shellicar requested a review from bananabot9000 March 28, 2026 09:37
Copy link
Copy Markdown
Collaborator

@bananabot9000 bananabot9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. All four issues from #133 addressed correctly:

  • stripAnsiLength() utility in ansi.ts -- clean, honest about scope (ANSI only, not multi-width)
  • Issues 1 & 2 in renderer.ts -- cursorCol and wrap loop use stripAnsiLength, cursor self-wrap added
  • Issues 3 & 4 in terminal.ts -- editorScreenLines and cursorLinesFromBottom use stripAnsiLength
  • buildPreviewLines correctly left alone (plain text, no ANSI)

Worker stayed in scope. Ship it.

@shellicar shellicar merged commit f87c538 into main Mar 28, 2026
4 checks passed
@shellicar shellicar deleted the fix/sticky-zone-width-math branch March 28, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sticky zone corruption on terminal resize/zoom

2 participants