Skip to content

Commit

Permalink
Merge pull request #15174 from felixfbecker/repl-links-fix
Browse files Browse the repository at this point in the history
Repl links fixes #13370
  • Loading branch information
isidorn authored Nov 10, 2016
2 parents 7186b3e + 9cbfd08 commit 477419a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/vs/workbench/parts/debug/electron-browser/replViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class ReplExpressionsRenderer implements IRenderer {
// group 3: line number
// group 4: column number
// eg: at Context.<anonymous> (c:\Users\someone\Desktop\mocha-runner\test\test.js:26:11)
/((\/|[a-zA-Z]:\\)[^\(\)<>\'\"\[\]]+):(\d+):(\d+)/
/(?:file:\/\/)?((\/|[a-zA-Z]:\\)?[^\(\)<>\'\"\[\]:]+):(\d+)(?::(\d+))?/
];

private static LINE_HEIGHT_PX = 18;
Expand Down Expand Up @@ -362,7 +362,7 @@ export class ReplExpressionsRenderer implements IRenderer {
link.textContent = text.substr(match.index, match[0].length);
link.title = isMacintosh ? nls.localize('fileLinkMac', "Click to follow (Cmd + click opens to the side)") : nls.localize('fileLink', "Click to follow (Ctrl + click opens to the side)");
linkContainer.appendChild(link);
link.onclick = (e) => this.onLinkClick(new StandardMouseEvent(e), resource, Number(match[3]), Number(match[4]));
link.onclick = (e) => this.onLinkClick(new StandardMouseEvent(e), resource, Number(match[3]), match[4] && Number(match[4]));

let textAfterLink = text.substr(match.index + match[0].length);
if (textAfterLink) {
Expand All @@ -378,7 +378,7 @@ export class ReplExpressionsRenderer implements IRenderer {
return linkContainer || text;
}

private onLinkClick(event: IMouseEvent, resource: uri, line: number, column: number): void {
private onLinkClick(event: IMouseEvent, resource: uri, line: number, column: number = 0): void {
const selection = window.getSelection();
if (selection.type === 'Range') {
return; // do not navigate when user is selecting
Expand Down

0 comments on commit 477419a

Please sign in to comment.