From 0a83040ac88fcfc3bd2dc3a108217dd5f9145e4d Mon Sep 17 00:00:00 2001 From: Simon Lamon Date: Sun, 31 Jul 2022 07:38:14 +0000 Subject: [PATCH] clearAllMarkers --- src/common/buffer/BufferSet.test.ts | 13 +++++++++++++ src/common/buffer/BufferSet.ts | 1 + 2 files changed, 14 insertions(+) diff --git a/src/common/buffer/BufferSet.test.ts b/src/common/buffer/BufferSet.test.ts index 894ebb20..a200060f 100644 --- a/src/common/buffer/BufferSet.test.ts +++ b/src/common/buffer/BufferSet.test.ts @@ -71,4 +71,17 @@ describe('BufferSet', () => { assert.equal(bufferSet.active.y, 10); }); }); + + describe('markers', () => { + beforeEach(() => { + }); + + 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); + }); + }); }); diff --git a/src/common/buffer/BufferSet.ts b/src/common/buffer/BufferSet.ts index de220e8f..7d07cec8 100644 --- a/src/common/buffer/BufferSet.ts +++ b/src/common/buffer/BufferSet.ts @@ -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({