mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #3671 from meganrogge/master
during buffer clear, don't dispose of markers on first line
This commit is contained in:
@@ -1301,7 +1301,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
// Don't clear if it's already clear
|
||||
return;
|
||||
}
|
||||
this.buffer.clearMarkers();
|
||||
this.buffer.clearAllMarkers(0);
|
||||
this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);
|
||||
this.buffer.lines.length = 1;
|
||||
this.buffer.ydisp = 0;
|
||||
|
||||
@@ -257,7 +257,10 @@ export class MockBuffer implements IBuffer {
|
||||
public getWhitespaceCell(attr?: IAttributeData): ICellData {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
public clearMarkers(): void {
|
||||
public clearMarkers(y: number): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
public clearAllMarkers(excludeY: number): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
+23
-11
@@ -585,20 +585,32 @@ export class Buffer implements IBuffer {
|
||||
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
|
||||
}
|
||||
|
||||
public clearMarkers(y?: number): void {
|
||||
/**
|
||||
* Clears markers on single line.
|
||||
* @param y The line to clear.
|
||||
*/
|
||||
public clearMarkers(y: number): void {
|
||||
this._isClearing = true;
|
||||
if (y !== undefined) {
|
||||
for (let i = 0; i < this.markers.length; i++) {
|
||||
if (this.markers[i].line === y) {
|
||||
this.markers[i].dispose();
|
||||
this.markers.splice(i--, 1);
|
||||
}
|
||||
for (let i = 0; i < this.markers.length; i++) {
|
||||
if (this.markers[i].line === y) {
|
||||
this.markers[i].dispose();
|
||||
this.markers.splice(i--, 1);
|
||||
}
|
||||
} else {
|
||||
for (const marker of this.markers) {
|
||||
marker.dispose();
|
||||
}
|
||||
this._isClearing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears markers on all lines except for those on a particular line.
|
||||
* @param excludeY The line to exclude.
|
||||
*/
|
||||
public clearAllMarkers(excludeY: number): void {
|
||||
this._isClearing = true;
|
||||
for (let i = 0; i < this.markers.length; i++) {
|
||||
if (this.markers[i].line !== excludeY) {
|
||||
this.markers[i].dispose();
|
||||
this.markers.splice(i--, 1);
|
||||
}
|
||||
this.markers = [];
|
||||
}
|
||||
this._isClearing = false;
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -45,7 +45,8 @@ export interface IBuffer {
|
||||
getNullCell(attr?: IAttributeData): ICellData;
|
||||
getWhitespaceCell(attr?: IAttributeData): ICellData;
|
||||
addMarker(y: number): IMarker;
|
||||
clearMarkers(y?: number): void;
|
||||
clearMarkers(y: number): void;
|
||||
clearAllMarkers(excludeY: number): void;
|
||||
}
|
||||
|
||||
export interface IBufferSet extends IDisposable {
|
||||
|
||||
Reference in New Issue
Block a user