IL Insert Line
Insert n blank lines at the cursor, pushing the lines below it down.
CSI Pn L
- Defaults
- Pn = 1
- ECMA-48
- §8.3.67 IL – Insert Line, p. 47
- DEC STD 070
- §5.11 Insert Line, p. 5-146
- VT510
- IL—Insert Line
Insert Pn blank lines at the line the cursor is on. That line and the lines below it move down to make room, and lines pushed past the bottom margin are lost. A 0 is taken as 1.
Only the scrolling region is affected. Lines above the cursor and below the bottom margin stay where they are, and with left and right margins set, only the part of each line between them moves. If the cursor is outside the scrolling region, whether above or below it or to one side of it, IL does nothing at all.
Afterwards the cursor is at the left margin of the line it was on: DEC STD 070 says the active position is set to the left margin and the active line does not change. ECMA-48 says the same in its own terms, moving the active position to the line home position.
DL is the reverse. SD also moves lines down, but from the top of the scrolling region, wherever the cursor is.
Validation
IL-1: Insert one line
1\r\n2\r\n3\r\n4
\e[2;3H
\e[L
|1____|
|_____|
|2____|
|3____|
cursor 2,1
IL-2: Lines pushed off the bottom are lost
1\r\n2\r\n3\r\n4
\e[2;1H
\e[2L
|1____|
|_____|
|_____|
|2____|
IL-3: Only the scrolling region moves
1\r\n2\r\n3\r\n4
\e[1;3r # region is lines 1 to 3; homes the cursor
\e[2;1H
\e[L
|1____|
|_____|
|2____|
|4____|
IL-4: Nothing happens outside the scrolling region
1\r\n2\r\n3\r\n4
\e[2;3r # region is lines 2 and 3
\e[4;1H # below it
\e[L
|1____|
|2____|
|3____|
|4____|
cursor 4,1
IL-5: Inside left and right margins
abcde\r\nfGHIj\r\nkLMNo\r\npQRSt\r\nuvwxy
\e[?69h # allow left and right margins
\e[2;4s # margins at columns 2 and 4
\e[2;4r # region is lines 2 to 4
\e[2;3H # on the H
\e[L
|abcde|
|f___j|
|kGHIo|
|pLMNt|
|uvwxy|
cursor 2,2