From cc1791584f24f5cc734f2fe0a8d3937a72193076 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 30 Sep 2013 15:35:29 -0700 Subject: [PATCH] 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). --- src/librustdoc/html/static/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index bf9e9ac8027..bf40261e765 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -224,8 +224,8 @@ }, 20); }); - $(document).off('keyup.searchnav'); - $(document).on('keyup.searchnav', function (e) { + $(document).off('keypress.searchnav'); + $(document).on('keypress.searchnav', function (e) { var $active = $results.filter('.highlighted'); if (e.keyCode === 38) { // up @@ -321,8 +321,8 @@ output += "

"; $('#main.content').addClass('hidden'); $('#search.content').removeClass('hidden').html(output); - $('.search-results .desc').width($('.content').width() - 40 - - $('.content td:first-child').first().width()); + $('#search .desc').width($('#search').width() - 40 - + $('#search td:first-child').first().width()); initSearchNav(); }