Skip to content

Commit faa60be

Browse files
committed
add missing insert and delete events to CircularList.splice
1 parent e95f981 commit faa60be

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/browser/Terminal.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,15 +1582,16 @@ describe('Terminal', () => {
15821582
// trimmed markers should contain line -1
15831583
assert.deepEqual(disposeStack.map(el => el.line), [-1, -1]);
15841584
});
1585-
it.skip('should dispose on DL', () => {
1585+
it('should dispose on DL', () => {
15861586
term.writeSync('\x1b[3;1H'); // move cursor to 0, 2
15871587
term.writeSync('\x1b[2M'); // delete 2 lines
15881588
assert.deepEqual(disposeStack, [markers[2], markers[3]]);
15891589
});
1590-
it.skip('should dispose on IL', () => {
1590+
it('should dispose on IL', () => {
15911591
term.writeSync('\x1b[3;1H'); // move cursor to 0, 2
15921592
term.writeSync('\x1b[2L'); // insert 2 lines
1593-
assert.deepEqual(disposeStack, [markers[3], markers[4]]);
1593+
assert.deepEqual(disposeStack, [markers[4], markers[3]]);
1594+
assert.deepEqual(markers.map(el => el.line), [0, 1, 4, -1, -1]);
15941595
});
15951596
it('should dispose on resize', () => {
15961597
term.resize(10, 2);

src/common/CircularList.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class CircularList<T> implements ICircularList<T> {
158158
this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];
159159
}
160160
this._length -= deleteCount;
161+
this.onDeleteEmitter.fire({index: start, amount: deleteCount});
161162
}
162163

163164
// Add items
@@ -167,6 +168,9 @@ export class CircularList<T> implements ICircularList<T> {
167168
for (let i = 0; i < items.length; i++) {
168169
this._array[this._getCyclicIndex(start + i)] = items[i];
169170
}
171+
if (items.length) {
172+
this.onInsertEmitter.fire({index: start, amount: items.length});
173+
}
170174

171175
// Adjust length as needed
172176
if (this._length + items.length > this._maxLength) {

0 commit comments

Comments
 (0)