Merge pull request #3644 from meganrogge/master

This commit is contained in:
Megan Rogge
2022-02-15 21:13:36 -06:00
committed by GitHub
4 changed files with 19 additions and 15 deletions
+7 -9
View File
@@ -59,7 +59,6 @@ export class DecorationService extends Disposable implements IDecorationService
export class Decoration extends Disposable implements IDecoration {
private readonly _marker: IMarker;
private _element: HTMLElement | undefined;
private _altBufferActive: boolean = false;
public isDisposed: boolean = false;
@@ -89,7 +88,6 @@ export class Decoration extends Disposable implements IDecoration {
this.anchor = options.anchor || 'left';
this.width = options.width || 1;
this.height = options.height || 1;
this.register(this._bufferService.buffers.onBufferActivate((event) => this._altBufferActive = event.activeBuffer === this._bufferService.buffers.alt));
}
public render(renderService: IRenderService, shouldRecreate?: boolean): void {
@@ -111,18 +109,18 @@ export class Decoration extends Disposable implements IDecoration {
}
this._element = document.createElement('div');
this._element.classList.add('xterm-decoration');
this._element.style.width = `${this.width * renderService.dimensions.scaledCellWidth}px`;
this._element.style.height = `${this.height * renderService.dimensions.scaledCellHeight}px`;
this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.scaledCellHeight}px`;
this._element.style.width = `${this.width * renderService.dimensions.actualCellWidth}px`;
this._element.style.height = `${this.height * renderService.dimensions.actualCellHeight}px`;
this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.actualCellHeight}px`;
if (this.x && this.x > this._bufferService.cols) {
// exceeded the container width, so hide
this._element.style.display = 'none';
}
if (this.anchor === 'right') {
this._element.style.right = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : '';
this._element.style.right = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : '';
} else {
this._element.style.left = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : '';
this._element.style.left = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : '';
}
this.register({
dispose: () => {
@@ -152,8 +150,8 @@ export class Decoration extends Disposable implements IDecoration {
// outside of viewport
this._element.style.display = 'none';
} else {
this._element.style.top = `${line * renderService.dimensions.scaledCellHeight}px`;
this._element.style.display = this._altBufferActive ? 'none' : 'block';
this._element.style.top = `${line * renderService.dimensions.actualCellHeight}px`;
this._element.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';
}
}
}
+2 -1
View File
@@ -1218,6 +1218,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._activeBuffer.getNullCell(this._eraseAttrData()),
this._eraseAttrData()
);
this._bufferService.buffer.clearMarkers(y);
if (clearWrap) {
line.isWrapped = false;
}
@@ -1232,6 +1233,7 @@ export class InputHandler extends Disposable implements IInputHandler {
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;
line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()));
line.isWrapped = false;
this._bufferService.buffer.clearMarkers(y);
}
/**
@@ -1292,7 +1294,6 @@ export class InputHandler extends Disposable implements IInputHandler {
this._resetBufferLine(j);
}
this._dirtyRowService.markDirty(0);
this._bufferService.buffer.clearMarkers();
break;
case 3:
// Clear scrollback (everything not in viewport)
+9 -4
View File
@@ -585,12 +585,17 @@ export class Buffer implements IBuffer {
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
}
public clearMarkers(): void {
public clearMarkers(y?: number): void {
this._isClearing = true;
for (const marker of this.markers) {
marker.dispose();
if (y) {
for (const marker of this.markers.filter(m => m.line === y)) {
marker.dispose();
}
} else {
for (const marker of this.markers) {
marker.dispose();
}
}
this.markers = [];
this._isClearing = false;
}
+1 -1
View File
@@ -45,7 +45,7 @@ export interface IBuffer {
getNullCell(attr?: IAttributeData): ICellData;
getWhitespaceCell(attr?: IAttributeData): ICellData;
addMarker(y: number): IMarker;
clearMarkers(): void;
clearMarkers(y?: number): void;
}
export interface IBufferSet extends IDisposable {