Skip to content

Commit b734fd8

Browse files
committed
Fix VCS links
cc #57
1 parent bf1b60d commit b734fd8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

static/rustw.out.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7508,10 +7508,10 @@ function RefMenu(props) {
75087508
}
75097509

75107510
function view_in_vcs(target) {
7511-
// FIXME this is broken
7512-
var file_name = history.state.file;
7513-
var line_id = target.getAttribute("id");
7514-
var line_number = parseInt(line_id.slice("src_line_number_".length));
7511+
var link = target.dataset.link;
7512+
var colon = link.lastIndexOf(':');
7513+
var file_name = link.substring(CONFIG.workspace_root.length + 2, colon);
7514+
var line_number = link.substring(colon + 1);
75157515
window.open(CONFIG.vcs_link.replace("$file", file_name).replace("$line", line_number), '_blank');
75167516
}
75177517

static/rustw.out.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/srcView.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ function RefMenu(props) {
8080
}
8181

8282
function view_in_vcs(target) {
83-
// FIXME this is broken
84-
const file_name = history.state.file;
85-
const line_id = target.getAttribute("id");
86-
const line_number = parseInt(line_id.slice("src_line_number_".length));
83+
const link = target.dataset.link;
84+
const colon = link.lastIndexOf(':');
85+
const file_name = link.substring(CONFIG.workspace_root.length + 2, colon);
86+
const line_number = link.substring(colon + 1);
8787
window.open(CONFIG.vcs_link.replace("$file", file_name).replace("$line", line_number), '_blank');
8888
}
8989

0 commit comments

Comments
 (0)