Skip to content

Commit

Permalink
Use explicit null check to ensure start/end row is valid
Browse files Browse the repository at this point in the history
It looks like this could have caused the inconsistent behavior with
links not activating and then working again after scrolling

Fixes xtermjs#1233
  • Loading branch information
Tyriar committed Jan 22, 2018
1 parent f554f53 commit 16abf71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Linkifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ export class Linkifier extends EventEmitter implements ILinkifier {
}

// Increase range to linkify
if (!this._rowsToLinkify.start) {
if (this._rowsToLinkify.start === null) {
this._rowsToLinkify.start = start;
this._rowsToLinkify.end = end;
} else {
this._rowsToLinkify.start = this._rowsToLinkify.start < start ? this._rowsToLinkify.start : start;
this._rowsToLinkify.end = this._rowsToLinkify.end > end ? this._rowsToLinkify.end : end;
this._rowsToLinkify.start = Math.min(this._rowsToLinkify.start, start);
this._rowsToLinkify.end = Math.max(this._rowsToLinkify.end, end);
}

// Clear out any existing links on this row range
Expand All @@ -97,7 +97,7 @@ export class Linkifier extends EventEmitter implements ILinkifier {
if (this._rowsTimeoutId) {
clearTimeout(this._rowsTimeoutId);
}
this._rowsTimeoutId = <number><any>setTimeout(() => this._linkifyRows(), Linkifier.TIME_BEFORE_LINKIFY);
this._rowsTimeoutId = window.setTimeout(() => this._linkifyRows(), Linkifier.TIME_BEFORE_LINKIFY);
}

/**
Expand Down

0 comments on commit 16abf71

Please sign in to comment.