Skip to content

Commit 6aafab0

Browse files
committed
fix link matching on Windows (when Julia is dead)
1 parent 51f4527 commit 6aafab0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/runtime/console.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import * as ssh from 'ssh2'
1515
const { changeprompt, changemodule, fullpath } =
1616
client.import({ msg: ['changeprompt', 'changemodule', 'resetprompt'], rpc: ['validatepath', 'fullpath'] })
1717

18-
let uriRegex
19-
if (process.platform === 'win32') {
20-
uriRegex = /(@ ([^\s]+)\s(.*?)\:(\d+)|((([a-zA-Z]:|\.\.?|\~)|([^\0<>\?\|\/\s!$`&*()\[\]+'":;])+)?((\\|\/)([^\0<>\?\|\/\s!$`&*()\[\]+'":;])+)+)(\:\d+)?)/
21-
} else {
22-
uriRegex = /(@ ([^\s]+)\s(.*?)\:(\d+)|(((\.\.?|\~)|([^\0\s!$`&*()\[\]+'":;\\])+)?(\/([^\0\s!$`&*()\[\]+'":;\\])+)+)(\:\d+)?)/
23-
}
18+
const isWindows = process.platform === 'win32'
19+
const uriRegex = isWindows ?
20+
/(@ ([^\s]+)\s(.*?)\:(\d+)|((([a-zA-Z]:|\.\.?|\~)|([^\0<>\?\|\/\s!$`&*()\[\]+'":;])+)?((\\|\/)([^\0<>\?\|\/\s!$`&*()\[\]+'":;])+)+)(\:\d+)?)/ :
21+
/(@ ([^\s]+)\s(.*?)\:(\d+)|(((\.\.?|\~)|([^\0\s!$`&*()\[\]+'":;\\])+)?(\/([^\0\s!$`&*()\[\]+'":;\\])+)+)(\:\d+)?)/
2422

2523
var whitelistedKeybindingsREPL = []
2624
var whitelistedKeybindingsTerminal = []
@@ -264,7 +262,10 @@ function handleLink (event, uri) {
264262
pending: atom.config.get('core.allowPendingPaneItems')
265263
})
266264
} else {
267-
urimatch = uri.match(/([^\:]+)(?:\:(\d+))?/)
265+
const matchregex = isWindows ?
266+
/(([a-zA-Z]\:)?[^\:]+)(?:\:(\d+))?/ :
267+
/([^\:]+)(?:\:(\d+))?/
268+
urimatch = uri.match(matchregex)
268269
if (urimatch) {
269270
const line = urimatch[2] !== null ? parseInt(urimatch[2]) : 0
270271
ink.Opener.open(urimatch[1], line - 1, {
@@ -287,7 +288,7 @@ let tooltip = null
287288

288289
function showTooltip (event, uri, location, terminal) {
289290
if (atom.config.get('julia-client.consoleOptions.linkModifier')) {
290-
let el = document.createElement('div')
291+
const el = document.createElement('div')
291292
el.classList.add('terminal-link-tooltip')
292293

293294
const terminalRect = terminal.element.getBoundingClientRect()

0 commit comments

Comments
 (0)