about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-09-30 15:35:29 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-09-30 20:31:19 -0700
commitcc1791584f24f5cc734f2fe0a8d3937a72193076 (patch)
tree87d5b9c8ed5ec2a83ce0fbf97e434b274269b369
parent863555f4fd9d8b0bd838420f69e4c2d84ac1dff9 (diff)
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).
-rw-r--r--src/librustdoc/html/static/main.js8
1 files 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 += "</p>";
             $('#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();
         }