fix buffers not clearing
This commit is contained in:
@@ -1308,6 +1308,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
|||||||
// Don't clear if it's already clear
|
// Don't clear if it's already clear
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.buffer.clearMarkers();
|
||||||
this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);
|
this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);
|
||||||
this.buffer.lines.length = 1;
|
this.buffer.lines.length = 1;
|
||||||
this.buffer.ydisp = 0;
|
this.buffer.ydisp = 0;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { DEFAULT_CHARSET } from 'common/data/Charsets';
|
|||||||
import { ExtendedAttrs } from 'common/buffer/AttributeData';
|
import { ExtendedAttrs } from 'common/buffer/AttributeData';
|
||||||
|
|
||||||
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
|
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
|
||||||
|
const enum BufferState { CLEARING = 'clearing' }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a terminal buffer (an internal state of the terminal), where the
|
* This class represents a terminal buffer (an internal state of the terminal), where the
|
||||||
@@ -43,6 +44,7 @@ export class Buffer implements IBuffer {
|
|||||||
private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);
|
private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);
|
||||||
private _cols: number;
|
private _cols: number;
|
||||||
private _rows: number;
|
private _rows: number;
|
||||||
|
private _state: string | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _hasScrollback: boolean,
|
private _hasScrollback: boolean,
|
||||||
@@ -584,6 +586,15 @@ export class Buffer implements IBuffer {
|
|||||||
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
|
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clearMarkers(): void {
|
||||||
|
this._state = BufferState.CLEARING;
|
||||||
|
for (const marker of this.markers) {
|
||||||
|
marker.dispose();
|
||||||
|
}
|
||||||
|
this.markers = [];
|
||||||
|
this._state = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public addMarker(y: number): Marker {
|
public addMarker(y: number): Marker {
|
||||||
const marker = new Marker(y);
|
const marker = new Marker(y);
|
||||||
this.markers.push(marker);
|
this.markers.push(marker);
|
||||||
@@ -615,7 +626,9 @@ export class Buffer implements IBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _removeMarker(marker: Marker): void {
|
private _removeMarker(marker: Marker): void {
|
||||||
this.markers.splice(this.markers.indexOf(marker), 1);
|
if (this._state !== BufferState.CLEARING) {
|
||||||
|
this.markers.splice(this.markers.indexOf(marker), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public iterator(trimRight: boolean, startIndex?: number, endIndex?: number, startOverscan?: number, endOverscan?: number): IBufferStringIterator {
|
public iterator(trimRight: boolean, startIndex?: number, endIndex?: number, startOverscan?: number, endOverscan?: number): IBufferStringIterator {
|
||||||
|
|||||||
Vendored
+2
-1
@@ -10,7 +10,7 @@ import { IEvent } from 'common/EventEmitter';
|
|||||||
export type BufferIndex = [number, number];
|
export type BufferIndex = [number, number];
|
||||||
|
|
||||||
export interface IBufferStringIteratorResult {
|
export interface IBufferStringIteratorResult {
|
||||||
range: {first: number, last: number};
|
range: { first: number, last: number };
|
||||||
content: string;
|
content: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +45,7 @@ export interface IBuffer {
|
|||||||
getNullCell(attr?: IAttributeData): ICellData;
|
getNullCell(attr?: IAttributeData): ICellData;
|
||||||
getWhitespaceCell(attr?: IAttributeData): ICellData;
|
getWhitespaceCell(attr?: IAttributeData): ICellData;
|
||||||
addMarker(y: number): IMarker;
|
addMarker(y: number): IMarker;
|
||||||
|
clearMarkers(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBufferSet extends IDisposable {
|
export interface IBufferSet extends IDisposable {
|
||||||
|
|||||||
Reference in New Issue
Block a user