]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Next link matcher ID must be non-static
authorDaniel Imms <daimms@microsoft.com>
Fri, 10 Feb 2017 20:29:36 +0000 (12:29 -0800)
committerDaniel Imms <daimms@microsoft.com>
Fri, 10 Feb 2017 20:29:36 +0000 (12:29 -0800)
src/Linkifier.ts

index 394d9ba751689cee7381e3abed04d741ecbf26c9..8bd300cc2701888c370d964ad6bbb91c0994a7ef 100644 (file)
@@ -37,11 +37,10 @@ const TIME_BEFORE_LINKIFY = 200;
  * The Linkifier applies links to rows shortly after they have been refreshed.
  */
 export class Linkifier {
-  private static _nextLinkMatcherId = HYPERTEXT_LINK_MATCHER_ID;
-
   private _rows: HTMLElement[];
   private _rowTimeoutIds: number[];
   private _linkMatchers: LinkMatcher[];
+  private _nextLinkMatcherId = HYPERTEXT_LINK_MATCHER_ID;
 
   constructor(rows: HTMLElement[]) {
     this._rows = rows;
@@ -84,11 +83,11 @@ export class Linkifier {
    * @return {number} The ID of the new matcher, this can be used to deregister.
    */
   public registerLinkMatcher(regex: RegExp, handler: LinkHandler, matchIndex?: number): number {
-    if (Linkifier._nextLinkMatcherId !== HYPERTEXT_LINK_MATCHER_ID && !handler) {
+    if (this._nextLinkMatcherId !== HYPERTEXT_LINK_MATCHER_ID && !handler) {
       throw new Error('handler cannot be falsy');
     }
     const matcher: LinkMatcher = {
-      id: Linkifier._nextLinkMatcherId++,
+      id: this._nextLinkMatcherId++,
       regex,
       handler,
       matchIndex