From 953387bab05ff668bf58cde7566007ab464d5c01 Mon Sep 17 00:00:00 2001 From: Taylor Whatley <32211852+1whatleytay@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:58:43 -0500 Subject: [PATCH] Fix issue with swapping tabs when highlight is out of bounds --- src/utils/debug.ts | 11 +++++++---- src/utils/midi.ts | 2 -- src/utils/query/access-manager.ts | 2 -- src/utils/symbol-highlight.ts | 9 ++++++++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/utils/debug.ts b/src/utils/debug.ts index 4003f75..2efe610 100644 --- a/src/utils/debug.ts +++ b/src/utils/debug.ts @@ -143,13 +143,16 @@ export async function build() { const current = tab() const { - binary, result } = await backend.assembleWithBinary(collectLines(current?.lines ?? []), current?.path ?? null) - if (binary !== null) { - buildLines.value = await backend.disassemblyDetails(binary.buffer) - } + // if (binary !== null) { + // try { + // buildLines.value = await backend.disassemblyDetails(binary.buffer) + // } catch (e) { + // console.error(e) + // } + // } consoleData.showConsole = true consoleData.tab = DebugTab.Console diff --git a/src/utils/midi.ts b/src/utils/midi.ts index e5ebf89..7cc8ec0 100644 --- a/src/utils/midi.ts +++ b/src/utils/midi.ts @@ -39,8 +39,6 @@ export async function playNote(note: MidiNote) { if (!loadedInstruments.has(note.name)) { if (!(await loadInstrument(note.name))) { - console.error(`Failed to load instrument ${note.name}`) - return await wake() } } diff --git a/src/utils/query/access-manager.ts b/src/utils/query/access-manager.ts index 3f544f1..63ea2c3 100644 --- a/src/utils/query/access-manager.ts +++ b/src/utils/query/access-manager.ts @@ -40,8 +40,6 @@ export async function selectOpenElf(): Promise | null> { })) as AccessFile | null if (result !== null) { - console.log(result) - return { ...result, data: Uint8Array.from(result.data) diff --git a/src/utils/symbol-highlight.ts b/src/utils/symbol-highlight.ts index 5e27475..2fabd18 100644 --- a/src/utils/symbol-highlight.ts +++ b/src/utils/symbol-highlight.ts @@ -129,7 +129,14 @@ export function useSymbolHighlight( const line = i + start if (!lines[line]) { - lines[line] = matchingTokens(storage.storage.highlights[line], line) + const highlights = storage.storage.highlights + + // Weird temporary case where highlights change. + if (line < highlights.length) { + lines[line] = matchingTokens(highlights[line], line) + } else { + lines[line] = [] + } } result[i] = lines[line]