Start registerLinkProvider tests

Bugs fixed:

- Not breaking on first link match for multiple providers
- Hover event wasn't fired when on last character of link
This commit is contained in:
Daniel Imms
2020-02-07 11:16:41 -08:00
parent f4a31251cb
commit 0103c689f7
2 changed files with 106 additions and 3 deletions
+4 -3
View File
@@ -117,6 +117,7 @@ export class Linkifier2 implements ILinkifier2 {
const currentLink = providerReplies.get(j);
if (currentLink) {
this._handleNewLink(currentLink);
break;
}
}
}
@@ -165,7 +166,7 @@ export class Linkifier2 implements ILinkifier2 {
return;
}
// Show the tooltip if the we have a link at the position
// Trigger hover if the we have a link at the position
if (this._linkAtPosition(link, position)) {
this._currentLink = link;
this._linkHover(this._element, link, this._lastMouseEvent);
@@ -215,8 +216,8 @@ export class Linkifier2 implements ILinkifier2 {
// If the start and end have the same y, then the position must be between start and end x
// If not, then handle each case seperately, depending on which way it wraps
return ((sameLine && link.range.start.x <= position.x && link.range.end.x > position.x) ||
(wrappedFromLeft && link.range.end.x > position.x) ||
return ((sameLine && link.range.start.x <= position.x && link.range.end.x >= position.x) ||
(wrappedFromLeft && link.range.end.x >= position.x) ||
(wrappedToRight && link.range.start.x <= position.x) ||
(wrappedFromLeft && wrappedToRight)) &&
link.range.start.y <= position.y &&