Skip to content

Commit

Permalink
Fix issue with swapping tabs when highlight is out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
1whatleytay committed Mar 7, 2024
1 parent a8c8e81 commit 953387b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/utils/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/utils/midi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/utils/query/access-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export async function selectOpenElf(): Promise<AccessFile<Uint8Array> | null> {
})) as AccessFile<number[]> | null

if (result !== null) {
console.log(result)

return {
...result,
data: Uint8Array.from(result.data)
Expand Down
9 changes: 8 additions & 1 deletion src/utils/symbol-highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 953387b

Please sign in to comment.