Use explicit null check to ensure start/end row is valid

It looks like this could have caused the inconsistent behavior with
links not activating and then working again after scrolling

Fixes #1233
This commit is contained in:
Daniel Imms
2018-01-22 11:51:09 -08:00
parent f554f53bda
commit 16abf71b78
+4 -4
View File
@@ -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
@@ -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);
}
/**