Skip to content

Commit 924b0f0

Browse files
committed
added support for different dropdowns in different variadic subslots by returning a list of menu-lists with the first item being an empty list
1 parent 65b21e3 commit 924b0f0

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

HISTORY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* support for variadic upvars in custom blocks
3636
* new 'parameter' custom block input type, same as 'upvar', but doesn't add a script variable when evaluated, supports variadicity
3737
* support for dynamically setting the contents of expanded variadic upvars and input slots by a user script in the block definition
38-
* support for user-scriptable rename-menus in upvars, including variadic ones
38+
* support for user-scriptable rename-menus in upvars, including variadic ones (a single menu is repeated in each non-unevaluated slot, a list of menu-lists whose first item is an empty list gets repeated across all subslots)
3939
* **Notable Changes:**
4040
* added icons to the IDE tabs (scripts, costumes, sounds)
4141
* flat design mode now (again) supports rounded corners (sigh...)
@@ -64,6 +64,9 @@
6464
* new Vietnamese translation, thank you, Serge Faure @seeeerge !!
6565
* German
6666

67+
### 2026-01-27
68+
* blocks: added support for different dropdowns in different variadic subslots by returning a list of menu-lists with the first item being an empty list
69+
6770
### 2026-01-26
6871
* blocks, byob: new %parameter custom block input type, same as %upvar, but doesn't add a script variable when evaluated, supports variadicity
6972

snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<script src="src/morphic.js?version=2025-12-17"></script>
1717
<script src="src/symbols.js?version=2024-12-09"></script>
1818
<script src="src/widgets.js?version=2025-12-19"></script>
19-
<script src="src/blocks.js?version=2026-01-26"></script>
19+
<script src="src/blocks.js?version=2026-01-27"></script>
2020
<script src="src/threads.js?version=2026-01-19"></script>
2121
<script src="src/objects.js?version=2026-01-19"></script>
2222
<script src="src/scenes.js?version=2026-01-04"></script>

src/blocks.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ CustomHatBlockMorph, ZOOM*/
162162

163163
// Global stuff ////////////////////////////////////////////////////////
164164

165-
modules.blocks = '2026-January-26';
165+
modules.blocks = '2026-January-27';
166166

167167
var SyntaxElementMorph;
168168
var BlockMorph;
@@ -11465,7 +11465,20 @@ InputSlotMorph.prototype.dynamicMenu = function (searching, enableKeyboard) {
1146511465
};
1146611466

1146711467
show = (result = new List()) => {
11468-
var menu = this.menuFromDict(format(result), null, enableKeyboard);
11468+
var first = result.at(1),
11469+
src, subslotIdx, menuIdx, menu;
11470+
11471+
if (this.parent instanceof MultiArgMorph &&
11472+
first instanceof List &&
11473+
first.isEmpty()
11474+
) {
11475+
subslotIdx = this.parent.inputs().indexOf(this);
11476+
menuIdx = (subslotIdx % (result.length() - 1)) + 2;
11477+
src = result.at(menuIdx);
11478+
} else {
11479+
src = result;
11480+
}
11481+
menu = this.menuFromDict(format(src), null, enableKeyboard);
1146911482
if (!menu) { // has already happened
1147011483
return;
1147111484
}

0 commit comments

Comments
 (0)