mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
Search keybinds fixes (#1748)
* fix: close keybind cheatsheet on escape press * feat: match all space separated words in keybind cheatsheet search
This commit is contained in:
@@ -123,6 +123,7 @@ DankModal {
|
|||||||
|
|
||||||
function generateCategories(query) {
|
function generateCategories(query) {
|
||||||
const lowerQuery = query ? query.toLowerCase().trim() : "";
|
const lowerQuery = query ? query.toLowerCase().trim() : "";
|
||||||
|
const lowerQueryWords = query.split(/\s+/);
|
||||||
const processed = {};
|
const processed = {};
|
||||||
|
|
||||||
for (const cat in rawBinds) {
|
for (const cat in rawBinds) {
|
||||||
@@ -135,10 +136,25 @@ DankModal {
|
|||||||
const keyLower = bind.key.toLowerCase();
|
const keyLower = bind.key.toLowerCase();
|
||||||
const descLower = bind.desc.toLowerCase();
|
const descLower = bind.desc.toLowerCase();
|
||||||
const actionLower = bind.action.toLowerCase();
|
const actionLower = bind.action.toLowerCase();
|
||||||
if (!(lowerQuery.length === 0 || keyLower.includes(lowerQuery) || descLower.includes(lowerQuery) || catLower.includes(lowerQuery) || actionLower.includes(lowerQuery)))
|
|
||||||
continue;
|
|
||||||
if (bind.hideOnOverlay)
|
if (bind.hideOnOverlay)
|
||||||
continue;
|
continue;
|
||||||
|
let shouldContinue = false;
|
||||||
|
for (let j = 0; j < lowerQueryWords.length; j++) {
|
||||||
|
const word = lowerQueryWords[j];
|
||||||
|
if (!(
|
||||||
|
word.length === 0 ||
|
||||||
|
keyLower.includes(word) ||
|
||||||
|
descLower.includes(word) ||
|
||||||
|
catLower.includes(word) ||
|
||||||
|
actionLower.includes(word)
|
||||||
|
)) {
|
||||||
|
shouldContinue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldContinue)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (bind.subcat) {
|
if (bind.subcat) {
|
||||||
hasSubcats = true;
|
hasSubcats = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user