跳到主要内容
ansicode

DECSDM — Sixel 显示模式(CSI ? 80 h / l)

选择 sixel 渲染完成后光标的停留位置 —— 图像左上角(设置)或图像下方(重置,现代默认)。

字节形式

涵盖所有常见的字符串字面量写法,方便正反查找。

\\x1b[\x1b[?80h (set) \x1b[?80l (reset)
\\033[\033[?80h / \033[?80l
\\e[\e[?80h / \e[?80l
ESC [ESC [ ? 80 h / ESC [ ? 80 l
hex1b 5b 3f 38 30 68 / 6c

说明

Sixel Display Mode —— 控制 sixel 图形块渲染完成后光标位置的 DEC 私有模式。**设置**(`\x1b[?80h`)选择 DEC 原始行为:光标返回 sixel 图像左上角,与渲染像素重叠。**重置**(`\x1b[?80l`,xterm 与多数现代模拟器的默认)把光标移到图像左下角**下方**的一格 —— 即在图片下方段落里下一个字符自然落点的单元。重置行为正是 `chafa`、`timg`、`image.nvim`、`imgcat`(kitty)、`viu` 等工具假定的行为 —— 多张图像纵向堆叠只需依次输出,光标自动落到每张图的下方。仅当希望在 sixel 图像上覆盖文字(水印、标签)而不显式移动光标时,才需启用设置模式。注意:kitty 自家图像协议(`dcs-kitty-graphics`)用它自己的光标推进标志(`C=0` 或 `C=1`),与 DECSDM 无关 —— DECSDM 仅作用于 DCS-P 载荷(sixel)。支持在 sixel 兼容模拟器间一致;不支持 sixel 的模拟器静默忽略。

规范出处: DEC VT340 (Sixel) / xterm-ctlseqs

参数

示例

bash
# Modern default — cursor lands below each image, so several stack vertically:\nprintf '\033[?80l'\ncat img1.six img2.six img3.six
python
import sys\nsys.stdout.write('\x1b[?80h')   # legacy DEC: cursor returns to image top-left\nwith open('logo.six', 'rb') as f: sys.stdout.buffer.write(f.read())
go
fmt.Print("\x1b[?80l")   // modern: cursor advances below sixel
javascript
process.stdout.write('\x1b[?80h')   // overlay text on next render
c
printf("\x1b[?80l");   /* required before image.nvim-style stacked render */

终端支持

xterm
支持
Linux console (fbcon)
不支持
macOS Terminal.app
不支持
iTerm2
支持
Windows Terminal
不支持
cmd.exe / ConPTY
不支持
kitty
不支持
alacritty
不支持
WezTerm
支持
Ghostty
部分
GNOME Terminal
不支持
Konsole
部分
tmux
不支持
GNU screen
不支持

相关序列