From 7e10717566a9bdae38681d447760064204c65210 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Sun, 17 Jul 2022 22:46:01 +0800 Subject: [PATCH] fix: handle uppercase in fuzzy search mode --- src/components/searchModes/fuzzyMode.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/searchModes/fuzzyMode.tsx b/src/components/searchModes/fuzzyMode.tsx index 291a529..746afb3 100644 --- a/src/components/searchModes/fuzzyMode.tsx +++ b/src/components/searchModes/fuzzyMode.tsx @@ -18,13 +18,10 @@ export const fuzzyMode: ModeShape = { } }, renderNodeLabelText(node, searchKey) { - const { name, path } = node + const { name } = node + const path = hasUpperCase(searchKey) ? node.path : node.path.toLowerCase() - const indexes = fuzzyMatchIndexes( - searchKey.toLowerCase(), - path.toLowerCase(), - path.length - name.length, - ) + const indexes = fuzzyMatchIndexes(searchKey, path, path.length - name.length) const chunks = name.split('/') let progress = 0 return chunks.map((chunk, index, chunks) => {