Skip to content

Commit

Permalink
WIP: First draft
Browse files Browse the repository at this point in the history
  • Loading branch information
bmf-ribeiro committed Mar 6, 2019
1 parent f41146f commit 51e2cdf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/addons/webLinks/webLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ function handleLink(event: MouseEvent, uri: string): void {
*/
export function webLinksInit(term: Terminal, handler: (event: MouseEvent, uri: string) => void = handleLink, options: ILinkMatcherOptions = {}): void {
options.matchIndex = 1;

handler = (event, uri) => {
if (!term.hasSelection()) {
window.open(uri, '_blank');
}
};

term.registerLinkMatcher(strictUrlRegex, handler, options);
}

Expand Down

0 comments on commit 51e2cdf

Please sign in to comment.