Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow markers on the alt buffer #3924

Merged
merged 6 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/browser/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,6 @@ export class Terminal extends CoreTerminal implements ITerminal {
}

public addMarker(cursorYOffset: number): IMarker | undefined {
// Disallow markers on the alt buffer
if (this.buffer !== this.buffers.normal) {
return;
}

return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);
}

Expand Down
10 changes: 10 additions & 0 deletions src/common/buffer/BufferSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,14 @@ describe('BufferSet', () => {
assert.equal(bufferSet.active.y, 10);
});
});

describe('markers', () => {
it('should clear the markers when the buffer is switched', () => {
bufferSet.activateAltBuffer();
bufferSet.alt.addMarker(1);
assert.equal(bufferSet.alt.markers.length, 1);
bufferSet.activateNormalBuffer();
assert.equal(bufferSet.alt.markers.length, 0);
});
});
});
1 change: 1 addition & 0 deletions src/common/buffer/BufferSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class BufferSet extends Disposable implements IBufferSet {
// The alt buffer should always be cleared when we switch to the normal
// buffer. This frees up memory since the alt buffer should always be new
// when activated.
this._alt.clearAllMarkers();
this._alt.clear();
this._activeBuffer = this._normal;
this._onBufferActivate.fire({
Expand Down