^[control-codes live in libghostty-vt

Private modes

DECAWM Autowrap Mode

Choose whether text reaching the right margin continues on the next line.

CSI ? 7 h
DEC STD 070
§D.6.2 Set/Reset Auto Wrap Mode, p. D-15
VT510
DECAWM—Autowrap Mode

CSI ? 7 h sets autowrap mode and CSI ? 7 l resets it.

With it set, text that reaches the right margin carries on at the start of the next line, scrolling if the cursor is on the bottom margin. Writing a character into the last column does not move the cursor on at once: DEC STD 070 says a Last Column Flag is set instead, and the next character printed first moves to the next line. This site calls that a pending wrap.

With it reset, the cursor stays in the last column, and each further character overwrites the one there. The VT510 manual says they “replace characters already on the page”.

Autowrap affects only printed characters. Cursor movement and control characters stop at the margin as they always do.

DEC STD 070 describes autowrap in an appendix of documented exceptions (§D.6.1, p. D-13), not in its main text. Its change history for the Character Cell Display section records that autowrap was “an exception to Level 1”, and that all references to it and to the Last Column Flag were removed from that section. The appendix also lists the controls that should clear a pending wrap, among them resetting autowrap mode, and warns that “existing products vary widely” in this.

The VT510 manual gives the default as no autowrap. xterm turns it on by default (autoWrap), and so does libghostty-vt.

Validation

DECAWM-1: On, the next character wraps

\e[?7h
ABCDE     # fills the line; a wrap is pending
F
|ABCDE|
|F____|
cursor 2,2

DECAWM-2: Off, the last column is overwritten

\e[?7l
ABCDE
FG
|ABCDG|
|_____|
cursor 1,5

DECAWM-3: Turned off with a wrap pending

ABCDE     # a wrap is pending
\e[?7l
F
|ABCDF|
|_____|

DECAWM-4: On to begin with

\e[?7$p   # DECRQM: is mode 7 set?
|_____|
reply \e[?7;1$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.