Skip to content

Commit

Permalink
Disable opcode autocompletion for script hex input
Browse files Browse the repository at this point in the history
  • Loading branch information
vostrnad committed Nov 13, 2024
1 parent ba9e019 commit b569fac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/SyntaxInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
export let invalid = false
export let type: 'asm' | 'hex'
interface Token {
text: string
position: number
Expand All @@ -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))
Expand Down Expand Up @@ -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)'
Expand Down
2 changes: 2 additions & 0 deletions src/routes/script/debugger/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@
<TabContent>
<TabPane tabId="code" tab="Script" active>
<SyntaxInput
type="asm"
invalid={!asmInputValid}
bind:value={asmInput}
bind:height={inputHeight}
/>
</TabPane>
<TabPane tabId="assembly" tab="Assembly">
<SyntaxInput
type="hex"
invalid={!hexInputValid}
bind:value={$hexInput}
bind:height={inputHeight}
Expand Down

0 comments on commit b569fac

Please sign in to comment.