Skip to content

Commit

Permalink
0832/rxFS: fix delete block, hide search block (#1854)
Browse files Browse the repository at this point in the history
- Delete blocks leave holes in the arrays, breaking other blocks
- The search block has been broken this entire time (`.indexOf(...) == undefined` is always false). It's not clear what it's even supposed to do, so just hide it.
  • Loading branch information
GarboMuffin authored Jan 8, 2025
1 parent d875ca0 commit b3960f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions extensions/0832/rxFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
{
blockIconURI: file,
opcode: "search",
hideFromPalette: true,
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate("search [STR]"),
arguments: {
Expand Down Expand Up @@ -200,8 +201,11 @@

del({ STR }) {
str = btoa(unescape(encodeURIComponent(STR)));
rxFSfi[rxFSsy.indexOf(str) + 1 - 1] = undefined;
rxFSsy[rxFSsy.indexOf(str) + 1 - 1] = undefined;
const index = rxFSsy.indexOf(str);
if (index !== -1) {
rxFSfi.splice(index, 1);
rxFSsy.splice(index, 1);
}
}

file({ STR, STR2 }) {
Expand Down
8 changes: 6 additions & 2 deletions extensions/0832/rxFS2.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
{
blockIconURI: folder,
opcode: "search",
hideFromPalette: true,
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({ id: "search", default: "search [STR]" }),
arguments: {
Expand Down Expand Up @@ -225,8 +226,11 @@

del({ STR }) {
str = encodeURIComponent(STR);
rxFSfi[rxFSsy.indexOf(str) + 1 - 1] = undefined;
rxFSsy[rxFSsy.indexOf(str) + 1 - 1] = undefined;
const index = rxFSsy.indexOf(str);
if (index !== -1) {
rxFSfi.splice(index, 1);
rxFSsy.splice(index, 1);
}
}

folder({ STR, STR2 }) {
Expand Down

0 comments on commit b3960f5

Please sign in to comment.