ICH Insert Character
Insert n blank cells at the cursor, shifting the rest of the line right.
CSI Pn @
- Defaults
- Pn = 1
- ECMA-48
- §8.3.64 ICH – Insert Character, p. 46
- DEC STD 070
- §5.11 Insert Character, p. 5-142
- VT510
- ICH—Insert Character
Insert Pn blank cells at the cursor. The cursor’s cell and everything to its right moves right by Pn, and whatever is pushed past the right margin is lost. A 0 is taken as 1. The cursor does not move.
With left and right margins set, only the part of the line inside them shifts, and nothing happens at all if the cursor is outside them.
DCH is the reverse, deleting cells and pulling the rest of the line left.
Validation
ICH-1: Insert two
ABCDE
\e[1;2H
\e[2@
|A__BCD|
cursor 1,2
ICH-2: Then write into the gap
ABCDE
\e[1;2H
\e[2@
XY
|AXYBCD|
ICH-3: Inside a right margin
ABCDEF
\e[?69h # allow left and right margins
\e[1;4s # margins at columns 1 and 4
\e[1;2H
\e[@
|A_BCEF|