add missing insert and delete events to CircularList.splice

This commit is contained in:
Jörg Breitbart
2020-10-03 17:11:49 +02:00
parent e95f9815d8
commit faa60be6fb
2 changed files with 8 additions and 3 deletions
+4 -3
View File
@@ -1582,15 +1582,16 @@ describe('Terminal', () => {
// trimmed markers should contain line -1
assert.deepEqual(disposeStack.map(el => el.line), [-1, -1]);
});
it.skip('should dispose on DL', () => {
it('should dispose on DL', () => {
term.writeSync('\x1b[3;1H'); // move cursor to 0, 2
term.writeSync('\x1b[2M'); // delete 2 lines
assert.deepEqual(disposeStack, [markers[2], markers[3]]);
});
it.skip('should dispose on IL', () => {
it('should dispose on IL', () => {
term.writeSync('\x1b[3;1H'); // move cursor to 0, 2
term.writeSync('\x1b[2L'); // insert 2 lines
assert.deepEqual(disposeStack, [markers[3], markers[4]]);
assert.deepEqual(disposeStack, [markers[4], markers[3]]);
assert.deepEqual(markers.map(el => el.line), [0, 1, 4, -1, -1]);
});
it('should dispose on resize', () => {
term.resize(10, 2);
+4
View File
@@ -158,6 +158,7 @@ export class CircularList<T> implements ICircularList<T> {
this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];
}
this._length -= deleteCount;
this.onDeleteEmitter.fire({index: start, amount: deleteCount});
}
// Add items
@@ -167,6 +168,9 @@ export class CircularList<T> implements ICircularList<T> {
for (let i = 0; i < items.length; i++) {
this._array[this._getCyclicIndex(start + i)] = items[i];
}
if (items.length) {
this.onInsertEmitter.fire({index: start, amount: items.length});
}
// Adjust length as needed
if (this._length + items.length > this._maxLength) {