From bf2698b37d1f4b97ca0951d5a9a2063e210f1400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Tue, 12 Nov 2024 12:17:37 +0100 Subject: [PATCH] expand variadic inputs to their initial slots amount (if any is specified) when restoring them (i.e. when removing an embedded reporter block) --- HISTORY.md | 3 +++ src/blocks.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index f271d6e67..0d3c5484f 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -11,10 +11,13 @@ * **Notable Fixes:** * fixed input names when querying a custom block definition that has no function body script * hide variadic input arrows in case the number of slots is fixed + * expand variadic inputs to their initial slots amount (if any is specified) when restoring them (i.e. when removing an embedded reporter block) ### 2024-11-12 * threads: fixed input names when querying a custom block definition that has no function body script * metaprogramming library: new "expand (input) to (n) slots" command +* blocks: hide variadic input arrows in case the number of slots is fixed +* blocks: expand variadic inputs to their initial slots amount (if any is specified) when restoring them (i.e. when removing an embedded reporter block) ### 2024-11-11 * threads: expose a copy of the custom block as "caller" to input slot reaction scripts inside custom block definitions diff --git a/src/blocks.js b/src/blocks.js index fe6bb7624..51aa2c6b8 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -1594,6 +1594,10 @@ SyntaxElementMorph.prototype.revertToEmptyInput = function (arg) { } this.replaceInput(arg, deflt); if (deflt instanceof MultiArgMorph) { + if (deflt.initialSlots) { + deflt.collapseAll(); + deflt.expandTo(deflt.initialSlots); + } deflt.refresh(); } else if (deflt instanceof RingMorph) { deflt.fixBlockColor(); @@ -14572,7 +14576,7 @@ MultiArgMorph.prototype.collapseAll = function () { }; MultiArgMorph.prototype.expandTo = function (arity = 0) { - // experimental for custom block arity control in v10.2 only + // experimental in v10.2 var len = this.inputs().length, i;