From 3716aad202f5f0587c735b66acd4e797881e5028 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 16 Mar 2018 07:21:14 -0700 Subject: [PATCH] Backtrack row to be linkified if the first row is wrapped --- src/Linkifier.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Linkifier.ts b/src/Linkifier.ts index 8552d8a5..21201a6d 100644 --- a/src/Linkifier.ts +++ b/src/Linkifier.ts @@ -158,14 +158,21 @@ export class Linkifier extends EventEmitter implements ILinkifier { */ private _linkifyRow(rowIndex: number): void { // Ensure the row exists - const absoluteRowIndex = this._terminal.buffer.ydisp + rowIndex; + let absoluteRowIndex = this._terminal.buffer.ydisp + rowIndex; if (absoluteRowIndex >= this._terminal.buffer.lines.length) { return; } - // Only attempt to linkify rows that start in the viewport if ((this._terminal.buffer.lines.get(absoluteRowIndex)).isWrapped) { - return; + // Only attempt to linkify rows that start in the viewport + if (rowIndex !== 0) { + return; + } + // If the first row is wrapped, backtrack to find the origin row and linkify that + do { + rowIndex--; + absoluteRowIndex--; + } while ((this._terminal.buffer.lines.get(absoluteRowIndex)).isWrapped); } // Construct full unwrapped line text