Skip to content

Commit cbff63a

Browse files
committed
Jump to new sheet and fix delete sheet bug
1 parent 8ebb37d commit cbff63a

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,3 @@
156156
vertical scrolling
157157
- Accidentally typing "RC" while typing another formula can cause everything
158158
to hang
159-
- Deleting a sheet with a selection throws an exception

src/Tabs.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@
8686
<script>
8787
import ContextMenu from "./ContextMenu.svelte";
8888
89-
import { Sheet } from "./classes.svelte.js";
90-
9189
let { globals = $bindable(), value = $bindable() } = $props();
9290
let tabs = $derived(globals.sheets.map((s) => s.name));
9391

src/classes.svelte.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,13 @@ functions.crypto = async (ticker) => {
397397
addSheet(name, rows, cols, formula, initial, start = this.sheets.length) {
398398
const sheet = new Sheet(name, rows, cols, formula, initial);
399399
sheet.globals = this;
400+
this.deselect();
400401
this.sheets.splice(start, 0, sheet);
402+
this.currentSheetIndex = start;
401403
}
402404

403405
deleteSheets(n, start = this.sheets.length - n) {
406+
this.deselect();
404407
return this.sheets.splice(start, n);
405408
}
406409
}

src/llm.svelte.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ llmToolFunctions.newSheet = function (name, cells) {
55
this.globals?.addSheet(name, cells.length, cols, (i, j) =>
66
cells[i]?.[j]?.toString(),
77
);
8-
this.globals.currentSheetIndex = this.globals.sheets.length - 1;
98
};
109
llmToolFunctions.newSheet.description =
1110
"takes a 2D array of strings containing formulas";

0 commit comments

Comments
 (0)