From a30bb22c7a222656df37c98e17068ba110c4276f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sat, 22 Sep 2018 15:20:31 +0200 Subject: [PATCH] fix comments to <80 --- src/Linkifier.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Linkifier.ts b/src/Linkifier.ts index 7d39d146..e5158e73 100644 --- a/src/Linkifier.ts +++ b/src/Linkifier.ts @@ -24,6 +24,7 @@ export class Linkifier extends EventEmitter implements ILinkifier { /** * Limit of the unwrapping line expansion (overscan) at the top and bottom * of the actual viewport in ASCII characters. + * A limit of 2000 should match most sane urls. */ protected static readonly OVERSCAN_CHAR_LIMIT = 2000; @@ -98,14 +99,16 @@ export class Linkifier extends EventEmitter implements ILinkifier { // Invalidate bad end row values (if a resize happened) 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. - // The unwrapping is needed to also match content that got wrapped across several buffer lines. - // To avoid a worst case szenario where the whole buffer contains just a single unwrapped string - // we limit this line expansion beyond the actual viewport to +OVERSCAN_CHAR_LIMIT chars (overscan) - // at the top and the bottom. - // This comes with the tradeoff that matches longer than OVERSCAN_CHAR_LIMIT chars will not match - // anymore at the viewport borders. + // 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. + // The unwrapping is needed to also match content that got wrapped across + // several buffer lines. To avoid a worst case szenario where the whole buffer + // contains just a single unwrapped string we limit this line expansion beyond + // the viewport to +OVERSCAN_CHAR_LIMIT chars (overscan) at top and bottom. + // This comes with the tradeoff that matches longer than OVERSCAN_CHAR_LIMIT + // chars will not match anymore at the viewport borders. const overscanLineLimit = Math.ceil(Linkifier.OVERSCAN_CHAR_LIMIT / this._terminal.cols); const iterator = this._terminal.buffer.iterator( false, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);