From b953f5b9dcb633d5b038b2435d1aa7ec87fe15ec Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 20:33:16 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=20Update=20search=20logic=20to=20p?= =?UTF-8?q?rocess=20all=20file=20lines=20and=20optimize=20display=20update?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/GamemasterExplorer.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue index f4be4de..b006317 100644 --- a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue +++ b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue @@ -603,14 +603,19 @@ const onSearchInput = debounce(async () => { const device = getDevicePerformance(); const chunkSize = device.recommendedChunkSize; - // Process in chunks - for (let i = 0; i < displayLines.value.length; i += chunkSize) { - const chunk = displayLines.value.slice(i, i + chunkSize); + // Search through ALL fileLines, not just displayLines + for (let i = 0; i < fileLines.value.length; i += chunkSize) { + const chunk = fileLines.value.slice(i, i + chunkSize); - chunk.forEach((line, idx) => { + chunk.forEach((lineContent, idx) => { const actualIndex = i + idx; - const matches = line.content.toLowerCase().includes(searchTerm); - displayLines.value[actualIndex].hasMatch = matches; + const matches = lineContent.toLowerCase().includes(searchTerm); + + // Only update displayLines if it's within the visible range + const displayIndex = displayLines.value.findIndex(l => l.lineNumber === actualIndex + 1); + if (displayIndex !== -1) { + displayLines.value[displayIndex].hasMatch = matches; + } if (matches) { results.push(actualIndex); @@ -619,7 +624,7 @@ const onSearchInput = debounce(async () => { // Update progress operationProgress.value.percent = Math.min( - ((i + chunkSize) / displayLines.value.length) * 100, + ((i + chunkSize) / fileLines.value.length) * 100, 100 );