mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
break into two methods
This commit is contained in:
@@ -585,24 +585,31 @@ export class Buffer implements IBuffer {
|
||||
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
|
||||
}
|
||||
|
||||
public clearMarkers(y?: number): void {
|
||||
/**
|
||||
* Clears markers on line @param y
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// buffer has been cleared
|
||||
// don't dispose of markers on the current line (0)
|
||||
this._isClearing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears markers on all lines except for
|
||||
* those on @param excludeY
|
||||
*/
|
||||
public clearAllMarkers(excludeY: number): void {
|
||||
this._isClearing = true;
|
||||
for (let i = 0; i < this.markers.length; i++) {
|
||||
if (this.markers[i].line !== 0) {
|
||||
if (this.markers[i].line !== excludeY) {
|
||||
this.markers[i].dispose();
|
||||
this.markers.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
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