Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cc17915

Browse files
committed
rustdoc: Detect repeated keys and fix width
When a key is pressed and held, this now does the OS-style repeating after a bit of a pause. Also fixes the width of search results to be correct (was changed beforehand and didn't catch this).
1 parent 863555f commit cc17915

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@
224224
}, 20);
225225
});
226226

227-
$(document).off('keyup.searchnav');
228-
$(document).on('keyup.searchnav', function (e) {
227+
$(document).off('keypress.searchnav');
228+
$(document).on('keypress.searchnav', function (e) {
229229
var $active = $results.filter('.highlighted');
230230

231231
if (e.keyCode === 38) { // up
@@ -321,8 +321,8 @@
321321
output += "</p>";
322322
$('#main.content').addClass('hidden');
323323
$('#search.content').removeClass('hidden').html(output);
324-
$('.search-results .desc').width($('.content').width() - 40 -
325-
$('.content td:first-child').first().width());
324+
$('#search .desc').width($('#search').width() - 40 -
325+
$('#search td:first-child').first().width());
326326
initSearchNav();
327327
}
328328

0 commit comments

Comments
 (0)