We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71cf364 commit 1bbb816Copy full SHA for 1bbb816
src/librustdoc/html/static/main.js
@@ -401,16 +401,21 @@ function getSearchElement() {
401
var prev_line_id = 0;
402
403
var set_fragment = function(name) {
404
+ var x = window.scrollX,
405
+ y = window.scrollY;
406
if (browserSupportsHistoryApi()) {
407
history.replaceState(null, null, "#" + name);
408
highlightSourceLines();
409
} else {
410
location.replace("#" + name);
411
}
412
+ // Prevent jumps when selecting one or many lines
413
+ window.scrollTo(x, y);
414
};
415
416
return function(ev) {
417
var cur_line_id = parseInt(ev.target.id, 10);
418
+ ev.preventDefault();
419
420
if (ev.shiftKey && prev_line_id) {
421
// Swap selection if needed
0 commit comments