@@ -1058,14 +1058,14 @@ window.initSearch = function(rawSearchIndex) {
1058
1058
return "<button>" + text + " <div class=\"count\">(" + nbElems + ")</div></button>" ;
1059
1059
}
1060
1060
1061
- function showResults ( results ) {
1061
+ function showResults ( results , go_to_first ) {
1062
1062
var search = searchState . outputElement ( ) ;
1063
- if ( results . others . length === 1
1063
+ if ( go_to_first || ( results . others . length === 1
1064
1064
&& getSettingValue ( "go-to-only-result" ) === "true"
1065
1065
// By default, the search DOM element is "empty" (meaning it has no children not
1066
1066
// text content). Once a search has been run, it won't be empty, even if you press
1067
1067
// ESC or empty the search input (which also "cancels" the search).
1068
- && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) )
1068
+ && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) ) )
1069
1069
{
1070
1070
var elem = document . createElement ( "a" ) ;
1071
1071
elem . href = results . others [ 0 ] . href ;
@@ -1242,7 +1242,7 @@ window.initSearch = function(rawSearchIndex) {
1242
1242
}
1243
1243
1244
1244
var filterCrates = getFilterCrates ( ) ;
1245
- showResults ( execSearch ( query , index , filterCrates ) ) ;
1245
+ showResults ( execSearch ( query , index , filterCrates ) , params . go_to_first ) ;
1246
1246
}
1247
1247
1248
1248
function buildIndex ( rawSearchIndex ) {
0 commit comments