MCPcopy
hub / github.com/xtermjs/xterm.js / deleteLines

Method deleteLines

src/common/InputHandler.ts:1344–1367  ·  view source on GitHub ↗

* CSI Ps M * Delete Ps Line(s) (default = 1) (DL). * * @vt: #Y CSI DL "Delete Line" "CSI Ps M" "Delete `Ps` lines at active row (default=1)." * For every deleted line at the scroll top one blank line at the scroll bottom gets appended. * The cursor is set to the first column. *

(params: IParams)

Source from the content-addressed store, hash-verified

1342 * DL has no effect if the cursor is outside the scroll margins.
1343 */
1344 public deleteLines(params: IParams): boolean {
1345 this._restrictCursor();
1346 let param = params.params[0] || 1;
1347
1348 if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {
1349 return true;
1350 }
1351
1352 const row: number = this._activeBuffer.ybase + this._activeBuffer.y;
1353
1354 let j: number;
1355 j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;
1356 j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;
1357 while (param--) {
1358 // test: echo -e '\e[44m\e[1M\e[0m'
1359 // blankLine(true) - xterm/linux behavior
1360 this._activeBuffer.lines.splice(row, 1);
1361 this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
1362 }
1363
1364 this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);
1365 this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?
1366 return true;
1367 }
1368
1369 /**
1370 * CSI Ps @

Callers 1

constructorMethod · 0.95

Calls 5

_restrictCursorMethod · 0.95
_eraseAttrDataMethod · 0.95
spliceMethod · 0.65
getBlankLineMethod · 0.65
markRangeDirtyMethod · 0.65

Tested by

no test coverage detected