Skip to main content
ansicode

DECAWM ?7 — Auto-wrap mode

Toggle whether the cursor wraps to the next line at the right margin (default: on).

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[?7h (enable wrap) \x1b[?7l (disable)
\\033[\033[?7h / \033[?7l
\\e[\e[?7h / \e[?7l
ESC [ESC [ ? 7 h / l
hex1b 5b 3f 37 68 / 6c

Description

DEC Auto-Wrap Mode. When enabled (`?7h`, the default), characters that would print past the rightmost column wrap to column 1 of the next row. When disabled (`?7l`), the cursor stays glued to the last column and each new character overwrites the previous one — useful for status lines and TUIs that draw exactly to the edge without unintentionally scrolling. Turn wrap off before drawing a fixed-width status bar; turn it back on before yielding the terminal back to the user, otherwise long shell-prompts truncate visibly.

Spec citation: xterm-ctlseqs (DEC Private Mode 7, DECAWM)

Examples

bash
printf '\033[?7l'   # disable wrap for status bar\nprintf '\033[?7h'   # restore
python
import sys; sys.stdout.write('\x1b[?7l')
go
fmt.Print("\x1b[?7l")
javascript
process.stdout.write('\x1b[?7l')
c
printf("\x1b[?7l");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
partial
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences