diff --git a/src/Linkifier.test.ts b/src/Linkifier.test.ts index 35610acb..1e4c0cdc 100644 --- a/src/Linkifier.test.ts +++ b/src/Linkifier.test.ts @@ -42,6 +42,7 @@ describe('Linkifier', () => { beforeEach(() => { terminal = new MockTerminal(); terminal.cols = 100; + terminal.rows = 10; terminal.buffer = new MockBuffer(); (terminal.buffer).setLines(new CircularList(20)); terminal.buffer.ydisp = 0; @@ -64,6 +65,7 @@ describe('Linkifier', () => { function assertLinkifiesRow(rowText: string, linkMatcherRegex: RegExp, links: {x: number, length: number}[], done: MochaDone): void { addRow(rowText); linkifier.registerLinkMatcher(linkMatcherRegex, () => {}); + terminal.rows = terminal.buffer.lines.length - 1; linkifier.linkifyRows(); // Allow linkify to happen setTimeout(() => { diff --git a/src/Linkifier.ts b/src/Linkifier.ts index eec1688c..0dd33a85 100644 --- a/src/Linkifier.ts +++ b/src/Linkifier.ts @@ -90,7 +90,7 @@ export class Linkifier extends EventEmitter implements ILinkifier { } // Invalidate bad end row values (if a resize happened) - const absoluteRowIndexEnd = Math.min(buffer.ydisp + this._rowsToLinkify.end + 1, buffer.ydisp + this._terminal.rows); + const absoluteRowIndexEnd = buffer.ydisp + Math.min(this._rowsToLinkify.end, this._terminal.rows) + 1; // iterate over the range of unwrapped content strings within start..end (excluding) // _doLinkifyRow gets full unwrapped lines with the start row as buffer offset for every matcher