* CSI Ps L * Insert Ps Line(s) (default = 1) (IL). * * @vt: #Y CSI IL "Insert Line" "CSI Ps L" "Insert `Ps` blank lines at active row (default=1)." * For every inserted line at the scroll top one line at the scroll bottom gets removed. * The cursor is set to the first column. *
(params: IParams)
| 1309 | * IL has no effect if the cursor is outside the scroll margins. |
| 1310 | */ |
| 1311 | public insertLines(params: IParams): boolean { |
| 1312 | this._restrictCursor(); |
| 1313 | let param = params.params[0] || 1; |
| 1314 | |
| 1315 | if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) { |
| 1316 | return true; |
| 1317 | } |
| 1318 | |
| 1319 | const row: number = this._activeBuffer.ybase + this._activeBuffer.y; |
| 1320 | |
| 1321 | const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom; |
| 1322 | const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1; |
| 1323 | while (param--) { |
| 1324 | // test: echo -e '\e[44m\e[1L\e[0m' |
| 1325 | // blankLine(true) - xterm/linux behavior |
| 1326 | this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1); |
| 1327 | this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData())); |
| 1328 | } |
| 1329 | |
| 1330 | this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom); |
| 1331 | this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only? |
| 1332 | return true; |
| 1333 | } |
| 1334 | |
| 1335 | /** |
| 1336 | * CSI Ps M |
no test coverage detected