rename to respectProtect

This commit is contained in:
Jörg Breitbart
2022-09-07 19:47:28 +02:00
parent e72e575c0f
commit b01a94f5bb
3 changed files with 22 additions and 22 deletions
+14 -14
View File
@@ -1121,14 +1121,14 @@ export class InputHandler extends Disposable implements IInputHandler {
* @param end end - 1 is last erased cell * @param end end - 1 is last erased cell
* @param cleanWrap clear the isWrapped flag * @param cleanWrap clear the isWrapped flag
*/ */
private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, protect: boolean = false): void { private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!; const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;
line.replaceCells( line.replaceCells(
start, start,
end, end,
this._activeBuffer.getNullCell(this._eraseAttrData()), this._activeBuffer.getNullCell(this._eraseAttrData()),
this._eraseAttrData(), this._eraseAttrData(),
protect respectProtect
); );
if (clearWrap) { if (clearWrap) {
line.isWrapped = false; line.isWrapped = false;
@@ -1140,9 +1140,9 @@ export class InputHandler extends Disposable implements IInputHandler {
* The cell gets replaced with the eraseChar of the terminal and the isWrapped property is set to false. * The cell gets replaced with the eraseChar of the terminal and the isWrapped property is set to false.
* @param y row index * @param y row index
*/ */
private _resetBufferLine(y: number, protect: boolean = false): void { private _resetBufferLine(y: number, respectProtect: boolean = false): void {
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!; const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;
line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), protect); line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);
this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y); this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);
line.isWrapped = false; line.isWrapped = false;
} }
@@ -1171,16 +1171,16 @@ export class InputHandler extends Disposable implements IInputHandler {
* *
* @vt: #Y CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Same as ED with respecting protection flag." * @vt: #Y CSI DECSED "Selective Erase In Display" "CSI ? Ps J" "Same as ED with respecting protection flag."
*/ */
public eraseInDisplay(params: IParams, protect: boolean = false): boolean { public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {
this._restrictCursor(this._bufferService.cols); this._restrictCursor(this._bufferService.cols);
let j; let j;
switch (params.params[0]) { switch (params.params[0]) {
case 0: case 0:
j = this._activeBuffer.y; j = this._activeBuffer.y;
this._dirtyRowService.markDirty(j); this._dirtyRowService.markDirty(j);
this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, protect); this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);
for (; j < this._bufferService.rows; j++) { for (; j < this._bufferService.rows; j++) {
this._resetBufferLine(j, protect); this._resetBufferLine(j, respectProtect);
} }
this._dirtyRowService.markDirty(j); this._dirtyRowService.markDirty(j);
break; break;
@@ -1188,13 +1188,13 @@ export class InputHandler extends Disposable implements IInputHandler {
j = this._activeBuffer.y; j = this._activeBuffer.y;
this._dirtyRowService.markDirty(j); this._dirtyRowService.markDirty(j);
// Deleted front part of line and everything before. This line will no longer be wrapped. // Deleted front part of line and everything before. This line will no longer be wrapped.
this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, protect); this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);
if (this._activeBuffer.x + 1 >= this._bufferService.cols) { if (this._activeBuffer.x + 1 >= this._bufferService.cols) {
// Deleted entire previous line. This next line can no longer be wrapped. // Deleted entire previous line. This next line can no longer be wrapped.
this._activeBuffer.lines.get(j + 1)!.isWrapped = false; this._activeBuffer.lines.get(j + 1)!.isWrapped = false;
} }
while (j--) { while (j--) {
this._resetBufferLine(j, protect); this._resetBufferLine(j, respectProtect);
} }
this._dirtyRowService.markDirty(0); this._dirtyRowService.markDirty(0);
break; break;
@@ -1202,7 +1202,7 @@ export class InputHandler extends Disposable implements IInputHandler {
j = this._bufferService.rows; j = this._bufferService.rows;
this._dirtyRowService.markDirty(j - 1); this._dirtyRowService.markDirty(j - 1);
while (j--) { while (j--) {
this._resetBufferLine(j, protect); this._resetBufferLine(j, respectProtect);
} }
this._dirtyRowService.markDirty(0); this._dirtyRowService.markDirty(0);
break; break;
@@ -1243,17 +1243,17 @@ export class InputHandler extends Disposable implements IInputHandler {
* *
* @vt: #Y CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Same as EL with respecting protecting flag." * @vt: #Y CSI DECSEL "Selective Erase In Line" "CSI ? Ps K" "Same as EL with respecting protecting flag."
*/ */
public eraseInLine(params: IParams, protect: boolean = false): boolean { public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {
this._restrictCursor(this._bufferService.cols); this._restrictCursor(this._bufferService.cols);
switch (params.params[0]) { switch (params.params[0]) {
case 0: case 0:
this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, protect); this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);
break; break;
case 1: case 1:
this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, protect); this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);
break; break;
case 2: case 2:
this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, protect); this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);
break; break;
} }
this._dirtyRowService.markDirty(this._activeBuffer.y); this._dirtyRowService.markDirty(this._activeBuffer.y);
+2 -2
View File
@@ -204,9 +204,9 @@ export interface IBufferLine {
addCodepointToCell(index: number, codePoint: number): void; addCodepointToCell(index: number, codePoint: number): void;
insertCells(pos: number, n: number, ch: ICellData, eraseAttr?: IAttributeData): void; insertCells(pos: number, n: number, ch: ICellData, eraseAttr?: IAttributeData): void;
deleteCells(pos: number, n: number, fill: ICellData, eraseAttr?: IAttributeData): void; deleteCells(pos: number, n: number, fill: ICellData, eraseAttr?: IAttributeData): void;
replaceCells(start: number, end: number, fill: ICellData, eraseAttr?: IAttributeData, protect?: boolean): void; replaceCells(start: number, end: number, fill: ICellData, eraseAttr?: IAttributeData, respectProtect?: boolean): void;
resize(cols: number, fill: ICellData): void; resize(cols: number, fill: ICellData): void;
fill(fillCellData: ICellData, protect?: boolean): void; fill(fillCellData: ICellData, respectProtect?: boolean): void;
copyFrom(line: IBufferLine): void; copyFrom(line: IBufferLine): void;
clone(): IBufferLine; clone(): IBufferLine;
getTrimmedLength(): number; getTrimmedLength(): number;
+6 -6
View File
@@ -303,9 +303,9 @@ export class BufferLine implements IBufferLine {
} }
} }
public replaceCells(start: number, end: number, fillCellData: ICellData, eraseAttr?: IAttributeData, protect: boolean = false): void { public replaceCells(start: number, end: number, fillCellData: ICellData, eraseAttr?: IAttributeData, respectProtect: boolean = false): void {
// full branching on protect==true, hopefully getting fast JIT for standard case // full branching on respectProtect==true, hopefully getting fast JIT for standard case
if (protect) { if (respectProtect) {
if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) { if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {
this.setCellFromCodePoint(start - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs()); this.setCellFromCodePoint(start - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());
} }
@@ -374,9 +374,9 @@ export class BufferLine implements IBufferLine {
} }
/** fill a line with fillCharData */ /** fill a line with fillCharData */
public fill(fillCellData: ICellData, protect: boolean = false): void { public fill(fillCellData: ICellData, respectProtect: boolean = false): void {
// full branching on protect==true, hopefully getting fast JIT for standard case // full branching on respectProtect==true, hopefully getting fast JIT for standard case
if (protect) { if (respectProtect) {
for (let i = 0; i < this.length; ++i) { for (let i = 0; i < this.length; ++i) {
if (!this.isProtected(i)) { if (!this.isProtected(i)) {
this.setCell(i, fillCellData); this.setCell(i, fillCellData);