Skip to content

Commit

Permalink
allow shift clicking on source lines to extend highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Oct 7, 2015
1 parent bfe43ba commit 23fe3e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion root/static/js/syntaxhighlighter.js
Expand Up @@ -218,9 +218,17 @@ $(function () {
// the the link. instead, update the hash ourselves, but
// unset the id first so it doesn't scroll
e.preventDefault();

var line = linenr;
if (e.shiftKey && source.attr('data-line')) {
var startLine = parseLines(source.attr('data-line'))[0];
line = startLine < line ? startLine + '-' + line
: line + '-' + startLine;
}
link.removeAttr('id');
document.location.hash = '#' + id;
document.location.hash = '#L' + line;
link.attr('id', id);
source.attr('data-line', line);
});
}
});
Expand Down

0 comments on commit 23fe3e0

Please sign in to comment.