Skip to content

Commit 1d784d4

Browse files
committed
rustdoc: use raw search in URL
fixes #16385 fixes #16271
1 parent 0f5ce0f commit 1d784d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustdoc/html/static/main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@
368368
}
369369

370370
function getQuery() {
371-
var matches, type, query = $('.search-input').val();
371+
var matches, type, query, raw = $('.search-input').val();
372+
query = raw;
372373

373374
matches = query.match(/^(fn|mod|struct|enum|trait|t(ype)?d(ef)?)\s*:\s*/i);
374375
if (matches) {
@@ -379,6 +380,7 @@
379380
}
380381

381382
return {
383+
raw: raw,
382384
query: query,
383385
type: type,
384386
id: query + type,
@@ -534,10 +536,10 @@
534536
if (browserSupportsHistoryApi()) {
535537
if (!history.state && !params.search) {
536538
history.pushState(query, "", "?search=" +
537-
encodeURIComponent(query.query));
539+
encodeURIComponent(query.raw));
538540
} else {
539541
history.replaceState(query, "", "?search=" +
540-
encodeURIComponent(query.query));
542+
encodeURIComponent(query.raw));
541543
}
542544
}
543545

0 commit comments

Comments
 (0)