mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
parent
4d1432299f
commit
2f26b15995
@ -4013,9 +4013,10 @@ Happy writing!
|
||||
return;
|
||||
}
|
||||
|
||||
let liDom = domListSearchResults.children[curSearchIndex];
|
||||
if (liDom == null && domListSearchResults.children.length !== 0) {
|
||||
liDom = domListSearchResults.children[0];
|
||||
const searchResults = domListSearchResults.getElementsByTagName("li");
|
||||
let liDom = searchResults[curSearchIndex];
|
||||
if (liDom == null && searchResults.length !== 0) {
|
||||
liDom = searchResults[0];
|
||||
}
|
||||
if (liDom != null) {
|
||||
let aDom = liDom.children[0];
|
||||
@ -4110,14 +4111,15 @@ Happy writing!
|
||||
}
|
||||
|
||||
function moveSearchCursor(dir) {
|
||||
const searchResults = domListSearchResults.getElementsByTagName("li");
|
||||
if (
|
||||
curSearchIndex < 0 ||
|
||||
curSearchIndex >= domListSearchResults.children.length
|
||||
curSearchIndex >= searchResults.length
|
||||
) {
|
||||
if (dir > 0) {
|
||||
curSearchIndex = -1 + dir;
|
||||
} else if (dir < 0) {
|
||||
curSearchIndex = domListSearchResults.children.length + dir;
|
||||
curSearchIndex = searchResults.length + dir;
|
||||
}
|
||||
} else {
|
||||
curSearchIndex += dir;
|
||||
@ -4125,8 +4127,8 @@ Happy writing!
|
||||
if (curSearchIndex < 0) {
|
||||
curSearchIndex = 0;
|
||||
}
|
||||
if (curSearchIndex >= domListSearchResults.children.length) {
|
||||
curSearchIndex = domListSearchResults.children.length - 1;
|
||||
if (curSearchIndex >= searchResults.length) {
|
||||
curSearchIndex = searchResults.length - 1;
|
||||
}
|
||||
renderSearchCursor();
|
||||
}
|
||||
@ -4465,8 +4467,9 @@ Happy writing!
|
||||
|
||||
|
||||
function renderSearchCursor() {
|
||||
for (let i = 0; i < domListSearchResults.children.length; i += 1) {
|
||||
let liDom = domListSearchResults.children[i];
|
||||
const searchResults = domListSearchResults.getElementsByTagName("li");
|
||||
for (let i = 0; i < searchResults.length; i += 1) {
|
||||
let liDom = searchResults[i];
|
||||
if (curSearchIndex === i) {
|
||||
liDom.classList.add("selected");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user