Skip to content

Commit

Permalink
Merge pull request #446 from ankurp/master
Browse files Browse the repository at this point in the history
Do not fire autocomplete search on non-printable characters.

Closes #446
  • Loading branch information
lsegal committed Jan 19, 2012
2 parents 189fe9b + 4192ece commit 67a85d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions templates/default/fulldoc/html/js/full_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ var searchCache = [];
var searchString = '';
var regexSearchString = '';
var caseSensitiveMatch = false;
var ignoreKeyCodeMin = 8;
var ignoreKeyCodeMax = 46;
var commandKey = 91;

RegExp.escape = function(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
Expand All @@ -19,6 +22,9 @@ function fullListSearch() {
});

$('#search input').keyup(function() {
if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
|| event.keyCode == commandKey)
return;
searchString = this.value;
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
regexSearchString = RegExp.escape(searchString);
Expand Down

0 comments on commit 67a85d3

Please sign in to comment.