Skip to content

Commit

Permalink
Make source links highlight the entire definition and not just the fi…
Browse files Browse the repository at this point in the history
…rst line
  • Loading branch information
Seldaek authored and alexcrichton committed Oct 2, 2013
1 parent 49e6db7 commit f00d72b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustdoc/html/render.rs
Expand Up @@ -714,13 +714,18 @@ impl<'self> fmt::Default for Item<'self> {
do clean_srcpath(it.item.source.filename) |component| {
path.push(component.to_owned());
}
let href = if it.item.source.loline == it.item.source.hiline {
format!("{}", it.item.source.loline)
} else {
format!("{}-{}", it.item.source.loline, it.item.source.hiline)
};
write!(fmt.buf,
"<a class='source'
href='{root}src/{crate}/{path}.html\\#{line}'>[src]</a>",
href='{root}src/{crate}/{path}.html\\#{href}'>[src]</a>",
root = it.cx.root_path,
crate = it.cx.layout.crate,
path = path.connect("/"),
line = it.item.source.loline);
href = href);
}

// Write the breadcrumb trail header for the top
Expand Down

0 comments on commit f00d72b

Please sign in to comment.