Skip to content

Commit db1fd26

Browse files
authored
Merge pull request #3644 from meganrogge/master
2 parents d943aa3 + 816f62c commit db1fd26

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/browser/services/DecorationService.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export class DecorationService extends Disposable implements IDecorationService
5959
export class Decoration extends Disposable implements IDecoration {
6060
private readonly _marker: IMarker;
6161
private _element: HTMLElement | undefined;
62-
private _altBufferActive: boolean = false;
6362

6463
public isDisposed: boolean = false;
6564

@@ -89,7 +88,6 @@ export class Decoration extends Disposable implements IDecoration {
8988
this.anchor = options.anchor || 'left';
9089
this.width = options.width || 1;
9190
this.height = options.height || 1;
92-
this.register(this._bufferService.buffers.onBufferActivate((event) => this._altBufferActive = event.activeBuffer === this._bufferService.buffers.alt));
9391
}
9492

9593
public render(renderService: IRenderService, shouldRecreate?: boolean): void {
@@ -111,18 +109,18 @@ export class Decoration extends Disposable implements IDecoration {
111109
}
112110
this._element = document.createElement('div');
113111
this._element.classList.add('xterm-decoration');
114-
this._element.style.width = `${this.width * renderService.dimensions.scaledCellWidth}px`;
115-
this._element.style.height = `${this.height * renderService.dimensions.scaledCellHeight}px`;
116-
this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.scaledCellHeight}px`;
112+
this._element.style.width = `${this.width * renderService.dimensions.actualCellWidth}px`;
113+
this._element.style.height = `${this.height * renderService.dimensions.actualCellHeight}px`;
114+
this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.actualCellHeight}px`;
117115

118116
if (this.x && this.x > this._bufferService.cols) {
119117
// exceeded the container width, so hide
120118
this._element.style.display = 'none';
121119
}
122120
if (this.anchor === 'right') {
123-
this._element.style.right = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : '';
121+
this._element.style.right = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : '';
124122
} else {
125-
this._element.style.left = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : '';
123+
this._element.style.left = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : '';
126124
}
127125
this.register({
128126
dispose: () => {
@@ -152,8 +150,8 @@ export class Decoration extends Disposable implements IDecoration {
152150
// outside of viewport
153151
this._element.style.display = 'none';
154152
} else {
155-
this._element.style.top = `${line * renderService.dimensions.scaledCellHeight}px`;
156-
this._element.style.display = this._altBufferActive ? 'none' : 'block';
153+
this._element.style.top = `${line * renderService.dimensions.actualCellHeight}px`;
154+
this._element.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';
157155
}
158156
}
159157
}

src/common/InputHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,7 @@ export class InputHandler extends Disposable implements IInputHandler {
12181218
this._activeBuffer.getNullCell(this._eraseAttrData()),
12191219
this._eraseAttrData()
12201220
);
1221+
this._bufferService.buffer.clearMarkers(y);
12211222
if (clearWrap) {
12221223
line.isWrapped = false;
12231224
}
@@ -1232,6 +1233,7 @@ export class InputHandler extends Disposable implements IInputHandler {
12321233
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;
12331234
line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()));
12341235
line.isWrapped = false;
1236+
this._bufferService.buffer.clearMarkers(y);
12351237
}
12361238

12371239
/**
@@ -1292,7 +1294,6 @@ export class InputHandler extends Disposable implements IInputHandler {
12921294
this._resetBufferLine(j);
12931295
}
12941296
this._dirtyRowService.markDirty(0);
1295-
this._bufferService.buffer.clearMarkers();
12961297
break;
12971298
case 3:
12981299
// Clear scrollback (everything not in viewport)

src/common/buffer/Buffer.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,17 @@ export class Buffer implements IBuffer {
585585
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
586586
}
587587

588-
public clearMarkers(): void {
588+
public clearMarkers(y?: number): void {
589589
this._isClearing = true;
590-
for (const marker of this.markers) {
591-
marker.dispose();
590+
if (y) {
591+
for (const marker of this.markers.filter(m => m.line === y)) {
592+
marker.dispose();
593+
}
594+
} else {
595+
for (const marker of this.markers) {
596+
marker.dispose();
597+
}
592598
}
593-
this.markers = [];
594599
this._isClearing = false;
595600
}
596601

src/common/buffer/Types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface IBuffer {
4545
getNullCell(attr?: IAttributeData): ICellData;
4646
getWhitespaceCell(attr?: IAttributeData): ICellData;
4747
addMarker(y: number): IMarker;
48-
clearMarkers(): void;
48+
clearMarkers(y?: number): void;
4949
}
5050

5151
export interface IBufferSet extends IDisposable {

0 commit comments

Comments
 (0)