diff --git a/addons/xterm-addon-webgl/src/WebglRenderer.ts b/addons/xterm-addon-webgl/src/WebglRenderer.ts index 5d853f0f..e80464da 100644 --- a/addons/xterm-addon-webgl/src/WebglRenderer.ts +++ b/addons/xterm-addon-webgl/src/WebglRenderer.ts @@ -419,7 +419,6 @@ export class WebglRenderer extends Disposable implements IRenderer { if (this._workColors.fg & FgFlags.INVERSE) { if (bgOverride !== undefined && fgOverride === undefined) { // Resolve bg color type (default color has a different meaning in fg vs bg) - debugger; if ((this._workColors.bg & Attributes.CM_MASK) === Attributes.CM_DEFAULT) { fgOverride = (this._workColors.fg & ~(Attributes.RGB_MASK | FgFlags.INVERSE | Attributes.CM_MASK)) | ((this._colors.background.rgba >> 8 & 0xFFFFFF) & Attributes.RGB_MASK) | Attributes.CM_RGB; } else { diff --git a/src/common/SortedList.test.ts b/src/common/SortedList.test.ts index 5ecdbb77..ecafdb8f 100644 --- a/src/common/SortedList.test.ts +++ b/src/common/SortedList.test.ts @@ -74,9 +74,11 @@ describe('SortedList', () => { list.insert(8); list.insert(6); assertList([5, 5, 5, 6, 8, 8]); + deepStrictEqual(Array.from(list.getKeyIterator(1)), []); deepStrictEqual(Array.from(list.getKeyIterator(5)), [5, 5, 5]); deepStrictEqual(Array.from(list.getKeyIterator(6)), [6]); deepStrictEqual(Array.from(list.getKeyIterator(8)), [8, 8]); + deepStrictEqual(Array.from(list.getKeyIterator(9)), []); }); it('clear', () => { list.insert(1); diff --git a/src/common/SortedList.ts b/src/common/SortedList.ts index 2112a73f..051c6702 100644 --- a/src/common/SortedList.ts +++ b/src/common/SortedList.ts @@ -3,6 +3,11 @@ * @license MIT */ +/** + * A generic list that is maintained in sorted order and allows values with duplicate keys. This + * list is based on binary search and as such locating a key will take O(log n) amortized, this + * includes the by key iterator. + */ export class SortedList { private readonly _array: T[] = []; @@ -47,6 +52,9 @@ export class SortedList { return; } let i = this._search(key, 0, this._array.length - 1); + if (i < 0 || i >= this._array.length) { + return; + } if (this._getKey(this._array[i]) !== key) { return; }