mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
add missing insert and delete events to CircularList.splice
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user