Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ function parseIntOptional(value: string | undefined): number | undefined {
// This defines valid path characters for a link with a suffix, the first `[]` of the regex includes
// characters the path is not allowed to _start_ with, the second `[]` includes characters not
// allowed at all in the path. If the characters show up in both regexes the link will stop at that
// character, otherwise it will stop at a space character.
const linkWithSuffixPathCharacters = /(?<path>(?:file:\/\/\/)?[^\s\|<>\[\({][^\s\|<>]*)$/;
// character, otherwise it will stop at a space character. Box-drawing characters are excluded so
// terminal UI borders are handled consistently with pipe separators.
const linkWithSuffixPathCharacters = /(?<path>(?:file:\/\/\/)?[^\s\|\u2500-\u257F<>\[\({][^\s\|\u2500-\u257F<>]*)$/;
Comment thread
KTibow marked this conversation as resolved.

export function detectLinks(line: string, os: OperatingSystem) {
// 1: Detect all links on line via suffixes first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,11 @@ suite('TerminalLinkParsing', () => {
] as IParsedLink[]
);
});
test('should exclude pipe characters from link paths with suffixes', () => {
deepStrictEqual(
detectLinks('|C:\\Github\\microsoft\\vscode:400|', OperatingSystem.Windows),
[
test('should exclude pipe and box-drawing characters from link paths with suffixes', () => {
for (const separator of ['|', '\u2502', '\u2514', '\u251C']) {
deepStrictEqual(
detectLinks(`${separator}C:\\Github\\microsoft\\vscode:400${separator}`, OperatingSystem.Windows),
[
{
path: {
index: 1,
Expand All @@ -494,8 +495,9 @@ suite('TerminalLinkParsing', () => {
}
}
}
] as IParsedLink[]
);
] as IParsedLink[]
);
}
});
});

Expand Down