Skip to content

terminal: clear pending wrap when printing with DECAWM off - #14652

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
fornwall:decawm
Oct 12, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
fornwall:decawm

Conversation

@fornwall

Copy link
Copy Markdown
Contributor

Make printing with DECAWM disabled clear the pending wrap flag, avoiding an unexpected wrap after DECAWM is re-enabled.

Test case:

#!/bin/sh
printf '\033[2J\033[H\033[?7l'     # Clear screen and disable DECAWM
printf "%$(tput cols)s" | tr ' ' a # Fill row with 'a', setting pending wrap
printf '\033[Z'                    # Cursor Backward Tabulation (CBT)
printf 'X\033[?7hY\n'              # Print 'X', enable DECAWM, print 'Y'
  • Before: Y appears at the start of the second row.
  • After: Y appears immediately after X on the first row.
    • Matches the three terminal emulators I tested with: xterm, kitty and mac terminal.

AI disclosure: Initially created using opus 5.5 through claude code. Iterated on, reviewed and tested by me.

Make printing with DECAWM disabled clear the pending wrap flag,
avoiding an unexpected wrap after DECAWM is re-enabled.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
@fornwall
fornwall requested a review from a team as a code owner October 11, 2026 23:04
@ghostty-bot ghostty-bot Bot added the vt Control sequence related label Oct 11, 2026

@jcollie jcollie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@mitchellh
mitchellh merged commit 698f8f4 into ghostty-org:main Oct 12, 2026
@github-actions github-actions Bot added this to the 1.4.0 milestone Oct 12, 2026
@fornwall
fornwall deleted the decawm branch October 12, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vt Control sequence related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants