Skip to content

fix: copy should not include UI line wrapping#80

Open
hyldmo wants to merge 1 commit into
mainfrom
hyldmo/fix-copy-wrapping
Open

fix: copy should not include UI line wrapping#80
hyldmo wants to merge 1 commit into
mainfrom
hyldmo/fix-copy-wrapping

Conversation

@hyldmo
Copy link
Copy Markdown
Owner

@hyldmo hyldmo commented Mar 10, 2026

Summary

  • Adds .todo tests documenting that getText() should return unwrapped text (original line breaks only, not visual wrapping)
  • Currently getText() returns text with soft-wrap newlines baked in — e.g. a 120-char line in a 40-col terminal comes back as 3 lines

Root cause

ghostty-opentui's native getTerminalText() uses the formatter without unwrap: true, so it inserts \n at every visual row boundary including soft wraps. This affects both:

  • Y key (copy all) via getText()
  • Mouse selection via getSelectedText() which operates on the same wrapped text buffer

Upstream fix

PR submitted: remorses/ghostty-opentui#13

Once merged and released, bumping ghostty-opentui will make the .todo tests pass.

Test plan

  • bun test src/ui/pane.test.ts — 11 pass, 2 todo, 0 fail

🤖 Generated with Claude Code

getText() currently returns text with visual line breaks from terminal
wrapping baked in. These tests document the expected behavior: copy
should return original unwrapped text.

Blocked on upstream fix: remorses/ghostty-opentui#13

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant