From b569fac8d62bef31abafe7581c5ca34459f38642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Strnad?= <43024885+vostrnad@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:05:54 +0100 Subject: [PATCH] Disable opcode autocompletion for script hex input --- src/lib/SyntaxInput.svelte | 6 ++++-- src/routes/script/debugger/+page.svelte | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/SyntaxInput.svelte b/src/lib/SyntaxInput.svelte index c07a1ba..415b199 100644 --- a/src/lib/SyntaxInput.svelte +++ b/src/lib/SyntaxInput.svelte @@ -11,6 +11,8 @@ export let invalid = false + export let type: 'asm' | 'hex' + interface Token { text: string position: number @@ -26,7 +28,7 @@ let currentlyEditingToken: Token | undefined let suggestedOpcodes: string[] = [] - $: if (currentlyEditingToken) { + $: if (type === 'asm' && currentlyEditingToken) { const tokenUpper = currentlyEditingToken.text.toUpperCase() suggestedOpcodes = opcodeNames .filter((opcode) => opcode.includes(tokenUpper)) @@ -62,7 +64,7 @@ for (const match of (value || '').matchAll(/\S+/g)) { const token = match[0] let color: string | undefined - if (token.startsWith('OP_')) { + if (type === 'asm' && token.startsWith('OP_')) { color = 'var(--syntax-code)' } else if (/^[\da-f]+$/i.test(token)) { color = 'var(--syntax-data)' diff --git a/src/routes/script/debugger/+page.svelte b/src/routes/script/debugger/+page.svelte index d4f8e09..e63c9ad 100644 --- a/src/routes/script/debugger/+page.svelte +++ b/src/routes/script/debugger/+page.svelte @@ -98,6 +98,7 @@